summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/node_modules/okserver/index.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/node_modules/okserver/index.js b/app/node_modules/okserver/index.js
index ba4dd46..952602d 100644
--- a/app/node_modules/okserver/index.js
+++ b/app/node_modules/okserver/index.js
@@ -39,7 +39,23 @@ function OKServer(options) {
throw new Error('View doesn\'t provide middleware');
router[mount](route, handler);
});
+
+ /**
+ * Mount our middleware.
+ * Order is important here! Requests go down the middleware
+ * chain until they are handled with a response, which could
+ * happen anywhere in the chain. Watch out for middleware shadowing
+ * ither middleware.
+ */
+
+ // Serve user static files
+ app.use(express.static(root));
+ // Serve admin interface static files
+ app.use(adminPath, express.static(adminRoot));
+ // Application router
app.use(router);
+ // Make sure this lady is last. Checks whether the desired
+ // route has a trailing-slash counterpart and redirects there
app.use(slash());
/**