Speed improvements

This commit is contained in:
Jori Lallo
2016-07-22 00:12:04 -07:00
parent e2c69903b3
commit bdea1fb4c9

View File

@ -22,6 +22,7 @@ const router = new Router();
if (process.env.NODE_ENV === 'production') {
router.get('/service-worker.js', async (ctx) => {
ctx.set('Content-Type', 'application/javascript');
ctx.set('Cache-Control', `max-age=${30}`);
const stats = await sendfile(ctx, path.join(__dirname, './static/service-worker.js'));
if (!ctx.status) ctx.throw(httpErrors.NotFound());
});