Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including done-ssr-middleware with all npm packages installed. Try it out:

var doneSsrMiddleware = require("done-ssr-middleware")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

done-ssr-middleware v3.0.0

Express/Connect middleware for DoneJS applications

Build Status npm version

done-ssr-middleware

Greenkeeper badge

Simple Express/Connect middleware for server-side rendering your DoneJS application.

Install

npm install done-ssr-middleware

Usage

Use the middleware to add server-side rendering to an existing Express server:

var ssr = require('done-ssr-middleware');

app.use('/', ssr({
  config: __dirname + '/public/package.json!npm'
}));

The middleware includes a live-reload utility that can automatically refresh the cache for server-rendered responses. Use the liveReload option to enable this feature:

app.use('/', ssr({
  config: __dirname + '/public/package.json!npm',
  liveReload: true
}));

Note: Make sure the ssr middleware is the last middleware in the chain but before the error handler. Errors when rendering the application will be passed to your Express error handler. Error status codes (e.g. 404s or others) will be rendered with the application.

Options

This module shares the same system and options arguments as done-ssr.

License

MIT

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free