它是一套miox服务端渲染的中间件集合。
- 环境
koa@2x
- 框架
vuejs@2x
npm install --save-dev miox-koa-vue2x-server-render
const ServerRender = require('miox-koa-vue2x-server-render');
const config = require('./config');
const base = require('./ssr');
const server = new ServerRender(config);
const app = new Koa();
server.use(base);
server.connect(app);
app.listen(3000, () => console.log('start server at http://127.0.0.1:3000'));
configs:
cwd
[String] 基址whitelist
[Array] 白名单列表。将使用源码编译的正则表达式写入。hot
[Boolean] 默认false
。启动热更新。static
[Json] 静态资源缓存配置 { maxAge[Number:31536000], gzip[Boolean:false], dynamic[Boolean:true],... } # https://www.npmjs.com/package/koa-static-cachecache
[Boolean] 是否使用缓存?默认false
title
[String] 默认标题头app
[String] 入口文件绝对地址build
[String] 打包所在文件夹绝对地址prefix
[String] URL前缀
DEV:HMR:BEFORE
DEV:SERVER:BEFORE
DEV:SERVER:INJECT
CREATE:SERVER:BEFORE
PRO:STATIC:BEFORE
CREATE:SERVER:BEFORE