lint
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
const path = require('path');
|
import path from 'path';
|
||||||
import httpErrors from 'http-errors';
|
import httpErrors from 'http-errors';
|
||||||
import Koa from 'koa';
|
import Koa from 'koa';
|
||||||
import Router from 'koa-router';
|
import Router from 'koa-router';
|
||||||
@ -24,18 +24,18 @@ if (process.env.NODE_ENV === 'production') {
|
|||||||
'Cache-Control': `max-age=${356 * 24 * 60 * 60}`,
|
'Cache-Control': `max-age=${356 * 24 * 60 * 60}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
const stats = await sendfile(ctx, path.join(__dirname, '../dist/', ctx.path.substring(8)));
|
await sendfile(ctx, path.join(__dirname, '../dist/', ctx.path.substring(8)));
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('*', async (ctx) => {
|
router.get('*', async (ctx) => {
|
||||||
const stats = await sendfile(ctx, path.join(__dirname, '../dist/index.html'));
|
await sendfile(ctx, path.join(__dirname, '../dist/index.html'));
|
||||||
if (!ctx.status) ctx.throw(httpErrors.NotFound());
|
if (!ctx.status) ctx.throw(httpErrors.NotFound());
|
||||||
});
|
});
|
||||||
|
|
||||||
koa.use(subdomainRedirect());
|
koa.use(subdomainRedirect());
|
||||||
} else {
|
} else {
|
||||||
router.get('*', async (ctx) => {
|
router.get('*', async (ctx) => {
|
||||||
const stats = await sendfile(ctx, path.join(__dirname, './static/dev.html'));
|
await sendfile(ctx, path.join(__dirname, './static/dev.html'));
|
||||||
if (!ctx.status) ctx.throw(httpErrors.NotFound());
|
if (!ctx.status) ctx.throw(httpErrors.NotFound());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user