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

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -