q-locals

v0.3.2
resolve res.locals before render it
q promise express locals render

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);
npm i q-locals

Metadata

  • MIT
  • Whatever
  • undoZen
  • released 6/28/2014

Downloads

Maintainers