koa-next-middleware
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

koa-next-middleware

npm npm

Overview

Koa Next Middleware

Install

npm install koa-next-middleware

or

yarn add koa-next-middleware

Usage

const Koa = require('koa');
const Next = require('Next');
const LRUCache = require('lru-cache);
const NextMiddleware = require('koa-next-middleware');
 
const app = new Koa();
const isDev = process.env.NODE_ENV !== 'production';
const ssrCache = new LRUCache({
  max: 100,
  maxAge: 1000 * 60 * 60 // 1hour
});
const appnext = Next({
  dev: isDev
});
 
app.use(NextMiddleware(appnext, {
  cache: isDev ? null : ssrCache
}));
 
app.listen(3000);

LICENSE

MIT@PLDaily

Package Sidebar

Install

npm i koa-next-middleware

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

38.4 kB

Total Files

10

Last publish

Collaborators

  • pldaily