summary refs log tree commit diff stats
path: root/src/app.js
diff options
context:
space:
mode:
authorAlan Pearce2017-07-08 22:30:36 +0200
committerAlan Pearce2017-07-08 22:30:36 +0200
commitbe533ddc740c77551c714836da08a651b81825b6 (patch)
treea0ec9e5d4d3f14f0b6afaa3d0f8a84e02d9c1cf7 /src/app.js
parentf1dabb589af4cfaf15d04ff7c399f8a9a2d5223a (diff)
downloadhomestead-be533ddc740c77551c714836da08a651b81825b6.tar.lz
homestead-be533ddc740c77551c714836da08a651b81825b6.tar.zst
homestead-be533ddc740c77551c714836da08a651b81825b6.zip
refactor: assign responders to actions via front controller
Diffstat (limited to 'src/app.js')
-rw-r--r--src/app.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/app.js b/src/app.js
index b6d8beb..912dda2 100644
--- a/src/app.js
+++ b/src/app.js
@@ -6,6 +6,7 @@ const app = new Koa();
 const helmet = require("koa-helmet");
 
 const actions = require("./actions.js");
+const responders = require("./responders.js");
 
 const config = require("./modules/config.js");
 
@@ -19,9 +20,13 @@ module.exports = async function() {
     router.url("post", basename)
   );
 
-  router.get("home", "/", actions.home(config, Posts.posts));
+  router.get("home", "/", actions.home(config, responders.home, Posts.posts));
 
-  router.get("posts", "/post", actions.posts(config, Posts.posts));
+  router.get(
+    "posts",
+    "/post",
+    actions.posts(config, responders.list, Posts.posts)
+  );
 
   router.get(
     "highlight-theme",
@@ -29,13 +34,17 @@ module.exports = async function() {
     actions.highlightTheme(config)
   );
 
-  router.get("post", "/post/:filename", actions.post(config, Posts.posts));
+  router.get(
+    "post",
+    "/post/:filename",
+    actions.post(config, responders.post, Posts.posts)
+  );
 
   for (let [term, items] of Posts.taxonomies) {
     router.get(
       `taxon-${term}`,
       `/${term}/:value`,
-      actions.taxonGenerator(config, term, items)
+      actions.taxonGenerator(config, responders.list, term, items)
     );
   }