New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Promises #19
Comments
Definitely considering what working with Promises would look like in Nodal, and appreciate the feedback. :) |
Well mostly,
|
+1, particularly on the promise interface for the ORM. You can still expose the |
Or do like mongoose and return a promise if and only if no callback is passed |
👍 |
+1 couldn't the controller routes be generator functions like in KOA ? |
Closing right now; no intention to use promises in short-term future. Will re-approach in time. |
+1 for promises support. |
2 similar comments
+1 for promises support. |
+1 for promises support. |
I used Bluebird's promisifyAll as a quick way to add promise support. models/overrides.js var Promise = require('bluebird')
var Nodal = require('nodal')
var Composer = require('nodal/core/required/composer')
Promise.promisifyAll(Nodal.Model)
Promise.promisifyAll(Nodal.Model.prototype)
Promise.promisifyAll(Composer.prototype) controllers/dogs_controller.js show(){
Dog.
findAsync( this.params.route.id ).
then(dog => this.respond(dog)).
catch(err => this.respond(err))
} Hope this helps!! |
+1 for promises support. |
Given they're in the language standard now, it would probably be the better idea to use them or at least support them - especially since people want to use async/await or generator coroutines in new code.
The text was updated successfully, but these errors were encountered: