node.js - Is possible to bind to express callback promise? -
is possible bind express callback promise ?
var express = require('express'); var app = express(); app.param('test', some_function);
and have function has functionality of som_function returns promise. how bind promise url ?
you have wrap function has signature required express.
var express = require('express'); var app = express(); app.param('test', function (req, res, next, id) { some_function().done(function (err, data) { if (err) { res.send(500); // boo return; } next(); // yay }); });
Comments
Post a Comment