HTML server rendering middleware. Detects if an incoming request is requesting
text/html and calls a function to render the corresponding response.
Assuming the client is a choo app:
const render =const merry =const client =const app =appappstart
Sometimes you know the paths you're going to render up front, and want to cache them in a Node buffer so the reponse times are as fast as they can be.
const cache =const render =const merry =const client =const routes =default: '/404'routes: '/' '/bar' '/bar/baz' '/bar/:foobar'const app =appappstart
Create a new render function that takes a callback and returns a middleware
function. The callback should return a string synchronously. The middleware
function has the signature of
(req, res, next).
Cache routes into Node buffers. Takes an object containing a
of routes, and a
.default value for the default route to match if no other
routes could be matched.
$ npm install server-render