Cache static assets

This commit is contained in:
Jori Lallo
2016-05-27 00:23:16 -07:00
parent 317d071c68
commit 9cad1c5173

View File

@ -32,6 +32,11 @@ if (process.env.NODE_ENV === 'production') {
});
router.get('*', async (ctx) => {
// Cache forever
ctx.set({
'Cache-Control': 'max-age=999999999999',
});
const stats = await sendfile(ctx, path.join(__dirname, '../dist/index.html'));
if (!ctx.status) ctx.throw(httpErrors.NotFound());
});