q-locals

0.3.2 • Public • Published

q-locals

Usage

var express = require('express');
var app = express();
require('q-locals')(app);

It will monkey-patch app object to overwrite #render() and #json() method to resolve promise properties of res.locals and the second parameter of #render() method. It will not recursively resolve deep properties which means res.locals.someProp.promiseHere will not be resolved automatically.

You can also patch on express:

require('q-locals')(express);

or create a object which is Object.created of response and overwrite #render() and #json() methods:

app.response = require('q-locals').createResponse(app.response);

Package Sidebar

Install

npm i q-locals

Weekly Downloads

1

Version

0.3.2

License

MIT

Last publish

Collaborators

  • undozen