wikijs-fork/controllers/pages.js
2016-08-20 00:50:29 -04:00

25 lines
480 B
JavaScript

"use strict";
var express = require('express');
var router = express.Router();
/**
* Home
*/
router.get('/', (req, res) => {
var md = require('markdown-it')({
breaks: true,
linkify: true,
typographer: true
});
var Promise = require('bluebird');
var fs = Promise.promisifyAll(require("fs"));
fs.readFileAsync("repo/Gollum.md", "utf8").then(function(contents) {
res.render('pages/view', { contents: md.render(contents) });
});
});
module.exports = router;