1.0.1 • Published 5 years ago

koa-history-api-fallback-middleware v1.0.1

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

koa-history-api-fallback-middleware

Installation

npm i -S koa-history-api-fallback-middleware

or

npm i -D koa-history-api-fallback-middleware

Example

const path = require('path')
const Koa = require('koa')
const app = new Koa()

const historyMiddleware = require('koa-history-api-fallback-middleware')({
  rewrites: [{
    from: /^\/lvchao\/view\/*/,
    // to: function({ parsedUrl, match, req }) {
    //   return '/static/index.html'
    // },
    to: '/static/index.html'
  }]
})

app.use(historyMiddleware)
app.use(require('koa-static')(path.resolve(process.cwd(), './public')))

more