koa-spa-static
v1.0.2
Published
koa-static for vue/react single page
Downloads
9
Maintainers
Readme
koa-spa-static
用于koa部署单页面资源(仅推荐使用在 文档
,mock
等 dev 服务)
use koa to deploy static single page application source (just recommend with dev server such as document or mock-server)
Requirements
Installation
$ npm install koa-spa-static
Options
matchReg
Regex of matching front-end pagesstaticReg
Regex of matching front-end static. Defaults to "/static"root
koa-static root rootopts
koa-static opts options
Example
import koa from 'koa'
import spaStatic from 'koa-spa-static'
const app = koa()
app.use(spaStatic({
matchReg: /^(?!\/api)/, // 不以/api开头的接口(not use "/api" as prefix)
root: path.join(__dirname, './dist'),
}));
app.listen(3000)
console.log('listening on port 3000');