Skip to content

Express middleware that adds promises object and render method that waits for the promises

Notifications You must be signed in to change notification settings

lukechinworth/res-promises

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Express middleware that adds promises object and render method that waits for the promises

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published