This commit is contained in:
masnn committed 2020-06-11 22:46:10 +08:00
1 parent 8c20c34d8b
commit ca11d80776
45 files changed
+418 -444

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
const { Route, Handler } = require('../service/server');
const { NotFoundError } = require('../error');
class WikiHandler extends Handler {
async get({ name }) {
if (!global.Hydro.wiki[name]) throw new NotFoundError(name);
const contents = global.Hydro.wiki[name];
const path = [
['Hydro', '/'],
['wiki', '/wiki'],
[`wiki_${name}`, null],
];
this.response.body = {
path, contents, page_name: `wiki_${name}`,
};
this.response.template = 'wiki.html';
}
}
async function apply() {
Route('/wiki/:name', WikiHandler);
}
global.Hydro.handler.wiki = module.exports = apply;