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

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -