Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lukechinworth/res-promises
Express middleware that adds promises object and render method that waits for the promises
https://github.com/lukechinworth/res-promises
express middleware
Last synced: about 18 hours ago
JSON representation
Express middleware that adds promises object and render method that waits for the promises
- Host: GitHub
- URL: https://github.com/lukechinworth/res-promises
- Owner: lukechinworth
- Created: 2017-02-08T20:50:40.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-08T22:10:38.000Z (almost 8 years ago)
- Last Synced: 2024-10-11T20:38:11.663Z (about 1 month ago)
- Topics: express, middleware
- Language: JavaScript
- Size: 1.95 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### Purpose
This middleware adds two properties to express's `res` object:
* `promises` - empty object for other middlewares to store promises on
* `renderAfterPromises` - method which waits for all promises on `res.promises` to resolve before calling `res.render` with promise resolutions### Install
`npm install res-promises`### Use
```
const express = require('express');
const resPromises = require('res-promises');const app = express();
app.use(resPromises())
```
See `example` dir for how to use with other middleware.### Options
* `resPromises([overrideResRender])` - boolean to override `res`'s `render` method. Default method name is `renderAfterPromises`