summaryrefslogtreecommitdiff
path: root/app/node_modules/okserver/index.js
diff options
context:
space:
mode:
authorSean Fridman <fridman@mail.sfsu.edu>2015-04-07 12:37:45 -0400
committerSean Fridman <fridman@mail.sfsu.edu>2015-04-07 12:37:45 -0400
commit57b72a57449f00938dd80c17c9c138ecee8a2ad4 (patch)
treeaafefa7e392053fd7cee4cbecd4be41cc54f9f40 /app/node_modules/okserver/index.js
parentfc044bfa9a98e49ab2ba6e782d4df7470d082683 (diff)
Add static file serving
Diffstat (limited to 'app/node_modules/okserver/index.js')
-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());
/**