npm.io
0.1.0 • Published 7 years ago

koa2-history-api-fallback

Licence
MIT
Version
0.1.0
Deps
1
Size
5 kB
Vulns
0
Weekly
0
Stars
16

koa2-history-api-fallback

base 'connect-history-api-fallback' for SPA

Reason

Koa v2.x don't use yield*, so 'koa-connect-history-api-fallback' can't adapter for Koa v2.x .

Adapter for 'connect-history-api-fallback' for use with Koa ^2.0.0.

Solution

  1. use 'koa2-history-api-fallback'
  2. use 'koa-convert' convert old middleware ...
Installation
$ npm install --save 'koa2-history-api-fallback'
Example
const Koa = require('koa')

const historyFallback = require('koa2-history-api-fallback')

app.use(historyFallback())

app.use('other middleware')

Keywords