spa.js
412 Bytes
'use strict';
const Router = require('koa-router');
const r = new Router();
const isProd = process.env.NODE_ENV === 'production'
const staticServer = isProd ? '/dist' : '//127.0.0.1:9001/dist'
const spa = {
async page(ctx) {
await ctx.render('/spa/index', {
layout: false,
isProd,
staticServer
});
}
};
r.get('/*', spa.page);
module.exports = r;