wikijs-fork/controllers/pages.js

24 lines
478 B
JavaScript
Raw Normal View History

2016-08-17 03:56:08 +00:00
"use strict";
var express = require('express');
var router = express.Router();
/**
* Home
*/
router.get('/', (req, res) => {
2016-08-20 04:50:29 +00:00
var Promise = require('bluebird');
var fs = Promise.promisifyAll(require("fs"));
fs.readFileAsync("repo/Storage/Redis.md", "utf8").then(function(contents) {
let pageData = mark.parse(contents);
2016-08-24 21:17:59 +00:00
if(!pageData.meta.title) {
pageData.meta.title = 'Redis.md';
}
res.render('pages/view', { pageData });
2016-08-20 04:50:29 +00:00
});
2016-08-17 03:56:08 +00:00
});
module.exports = router;