Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/donejs/done-ssr-middleware
Express/Connect middleware for DoneJS applications
https://github.com/donejs/done-ssr-middleware
Last synced: 12 days ago
JSON representation
Express/Connect middleware for DoneJS applications
- Host: GitHub
- URL: https://github.com/donejs/done-ssr-middleware
- Owner: donejs
- License: mit
- Created: 2016-03-08T18:22:33.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-10-01T18:46:28.000Z (about 4 years ago)
- Last Synced: 2024-09-24T15:07:44.176Z (about 2 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/done-ssr-middleware
- Size: 146 KB
- Stars: 2
- Watchers: 6
- Forks: 5
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/donejs/done-ssr-middleware.svg?branch=master)](https://travis-ci.org/donejs/done-ssr-middleware)
[![npm version](https://badge.fury.io/js/done-ssr-middleware.svg)](http://badge.fury.io/js/done-ssr-middleware)# done-ssr-middleware
[![Greenkeeper badge](https://badges.greenkeeper.io/donejs/done-ssr-middleware.svg)](https://greenkeeper.io/)
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:
```js
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:
```js
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](https://github.com/donejs/done-ssr#system) and [options](https://github.com/donejs/done-ssr#options) arguments as done-ssr.
## License
MIT