Update server routing for "docs" urls

This commit is contained in:
Frank Li 2017-07-18 16:52:47 -07:00
parent 23f160f13a
commit e3b99f800b

View file

@ -116,7 +116,7 @@ function execute(port) {
reloadMetadataCategories(); reloadMetadataCategories();
/* handle all requests for document pages */ /* handle all requests for document pages */
const app = express().get(/docs\/[\s\S]*html$/, (req, res) => { const app = express().get(/docs\/[\s\S]*html$/, (req, res, next) => {
purgeCache(CWD + "/siteConfig.js"); purgeCache(CWD + "/siteConfig.js");
siteConfig = require(CWD + "/siteConfig.js"); siteConfig = require(CWD + "/siteConfig.js");
@ -138,6 +138,9 @@ function execute(port) {
let file = links[req.path.toString().replace(siteConfig.baseUrl, "")]; let file = links[req.path.toString().replace(siteConfig.baseUrl, "")];
file = CWD + "/../" + file; file = CWD + "/../" + file;
if (!fs.existsSync(file)) {
next();
}
console.log(file); console.log(file);
const result = readMetadata.processMetadata(file); const result = readMetadata.processMetadata(file);