Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/airtoxin/on-render
express middleware that execute a listener when a response render is called.
https://github.com/airtoxin/on-render
Last synced: about 9 hours ago
JSON representation
express middleware that execute a listener when a response render is called.
- Host: GitHub
- URL: https://github.com/airtoxin/on-render
- Owner: airtoxin
- License: mit
- Created: 2015-09-17T05:33:42.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-04-06T18:12:07.000Z (over 8 years ago)
- Last Synced: 2024-04-23T12:59:01.102Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# on-render [![Build Status](https://travis-ci.org/airtoxin/on-render.svg)](https://travis-ci.org/airtoxin/on-render)
express middleware that execute a listener when a response render is called.
## install
`$ npm install on-render`
## examples
```js
var express = require('express');
var onRender = require('on-render');var app = express();
var onRenderListener = onRender.create(function (req, res, rendering, view, options) {
console.log(rendering); // logged rendered content
});app.use(onRenderListener);
```## api
### `onRender.create(listenerFunction)`
Create express middleware that execute a listener function when a response render is called.
### `listenerFunction(req, res, rendering, view, options)`
Called when a response render is called.
+ `req`: express request object
+ `res`: express response object
+ `rendering`: rendered contents string
+ `view`: rendered view name
+ `options`: options object with rendering