server.js 652 Bytes
const express = require('express');
const app = express();
const original_url_mw = require('kml-original-url-mw');
const config = require('./init/config');

// 解析原始请求url
app.use(original_url_mw());

//markdown主题
app.use(express.static(__dirname + '/themes'));


const MdAction = require('./lib/md-action');

let base_path = config.md.base_path || {};
Object.keys(base_path).forEach(p => {
    app.use('/', new MdAction(p, base_path[p]))
});

//默认
app.use('/', new MdAction('/', 'md'));

const PORT = config.system.bind_port;
app.listen(PORT);
console.info(`Server is started up by binding ${PORT}. Visit http://localhost:${PORT}`);