diff options
author | Alan Pearce | 2017-07-03 21:39:43 +0200 |
---|---|---|
committer | Alan Pearce | 2017-07-03 21:55:41 +0200 |
commit | e7b08b1dfe3f2a2596deb6e2a72bb79805d3708f (patch) | |
tree | 027fda29fe96736d4ac641a1dfe0bfe657d3fd33 /src/app.js | |
parent | a67e38d1a82c95db5bd24183e81b31438f60dd2c (diff) | |
download | homestead-e7b08b1dfe3f2a2596deb6e2a72bb79805d3708f.tar.lz homestead-e7b08b1dfe3f2a2596deb6e2a72bb79805d3708f.tar.zst homestead-e7b08b1dfe3f2a2596deb6e2a72bb79805d3708f.zip |
feat: Add code block highlighting
Theme is configurable
Diffstat (limited to 'src/app.js')
-rw-r--r-- | src/app.js | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/src/app.js b/src/app.js index 1a0c5cb..6be44bd 100644 --- a/src/app.js +++ b/src/app.js @@ -14,32 +14,40 @@ const router = new Router(); app.context.getURL = router.url.bind(router); -const Posts = require("./domain/posts.js")(config.posts, basename => - router.url("post", basename) -); - -router.get("home", "/", actions.home(config, Posts.posts)); +module.exports = async function() { + const Posts = await require("./domain/posts.js")(config.posts, basename => + router.url("post", basename) + ); -router.get("post", "/post/:filename", actions.post(config, Posts.posts)); + router.get("home", "/", actions.home(config, Posts.posts)); -for (let [term, items] of Posts.taxonomies) { router.get( - `taxon-${term}`, - `/${term}/:value`, - actions.taxonGenerator(config, term, items) + "highlight-theme", + "/css/code.css", + actions.highlightTheme(config) ); -} -app.use( - helmet({ - hsts: { - setIf: ctx => ctx.secure - } - }) -); + router.get("post", "/post/:filename", actions.post(config, Posts.posts)); + + for (let [term, items] of Posts.taxonomies) { + router.get( + `taxon-${term}`, + `/${term}/:value`, + actions.taxonGenerator(config, term, items) + ); + } + + app.use( + helmet({ + hsts: { + setIf: ctx => ctx.secure + } + }) + ); -app.use(router.routes()).use(router.allowedMethods()); + app.use(router.routes()).use(router.allowedMethods()); -app.use(actions.serveFiles); + app.use(actions.serveFiles); -module.exports = app; + return app; +}; |