I'm using NodeJS with Express and using Bluebird for promises. I'm trying to promisify app object as below but once promisified functions always throw errors. Part of the code is below:
var express = require('express'),
app = express(),
bodyParser = require('body-parser'),
Promise = require("bluebird");
app.postAsync = Promise.promisify(app.post);
app.postAsync('/api/v1/users/update').then(function(req, res, next) {
// never gets here
})
.catch(function(err) {
console.log("doh!!!");
});
I tried to promisifyAll with same effect. Why is it failing and is there any way to promisify post/get?