q-json-response
v0.1.3
Published
A JSON response wrapper for Express using Q
Downloads
575
Readme
q-json-response
Usage:
var router = require('express').Router();
var jsonResponse = require('q-json-response');
var q = require('q');
router.get('/user', jsonResponse(function(request, response) {
return Users.getUser(request.query.userId)
.then(function(user) {
if(!user) {
return q.reject('invalid user');
}
return user;
});
}));