const Koa = require("koa"); const koaStatic = require("koa-static"); const path = require("path"); const mount = require("koa-mount"); module.exports = ({ host, port, routes }) => { const assets = new Koa(); assets.use(koaStatic(path.join(__dirname, "assets"))); const app = new Koa(); module.exports = app; app.on("error", e => { // Output full error objects e.message = e.stack; e.expose = true; return null; }); app.use(mount("/assets", assets)); // headers app.use(async (ctx, next) => { await next(); const csp = [ "default-src 'none'", "img-src 'self'", "form-action 'self'", "media-src 'self'", "style-src 'self' 'unsafe-inline'" ].join("; "); // Disallow scripts. ctx.set("Content-Security-Policy", csp); // Disallow