1.0.4 • Published 5 years ago

koa-push v1.0.4

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

Koa Push

Build Status

Koa middleware for handling client-side pushstate routes. By default, a push state request is any GET request that has no file extension and doesn't begin with /api/.

Install

npm install koa-push

Usage

import koaPushState from 'koa-push';

app.use(koaPushState('/path/to/index.html'));

Alternatively, you can pass your own check to determine if the request should be handled by the push state middleware:

import koaPushState, { isPushStateRouteDefault } from 'koa-push';

app.use(
  koaPushState(
    '/path/to/index.html',
    context =>
      isPushStateRouteDefault(context) ||
      context.request.path.startsWith('/routes/')
  )
);
1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago