summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/index.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/index.js b/src/index.js
index 6622a79..8c69cc8 100644
--- a/src/index.js
+++ b/src/index.js
@@ -3,6 +3,8 @@
 const Koa = require('koa')
 const app = new Koa()
 
+const send = require('koa-send')
+
 const config = require('./modules/config.js')
 
 const PORT = process.env.PORT || config.server.port
@@ -59,6 +61,15 @@ for (let [term, items] of taxonomies) {
 
 app.use(router.routes()).use(router.allowedMethods())
 
+const prefix = /^\/static\//
+app.use(async function (ctx) {
+  if (prefix.test(ctx.path)) {
+    await send(ctx, ctx.path.replace(prefix, ''), {
+      root: './static'
+    })
+  }
+})
+
 module.exports = app
 
 if (require.main === module) {