0.3.0 • Published 4 years ago
incremental-regeneration v0.3.0
incremental-regeneration
About
This middleware adds so-called Incremental Static Regeneration to your server.
Installation
npm i incremental-regeneration
Basic usage
import isrMiddleware from 'incremental-regeneration';
// define your server
const server = ...
const myFunctionThatRendersPage = (req, res) => void;
server.use(isrMiddleware({
middleware: myFunctionThatRendersPage,
revalidateTime: 10
}))
//
Options
revalidateTime
(in seconds): time boundary after which the resource would be regenerated
middleware
: function that matches type (req: http.ClientRequest, res: http.ServerResponse) => void. This function is expected to render a response and write it to res param.