-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Make app.listen() return a promise #482
Comments
you could just write your own lib that does |
what @juliangruber said |
👍 for what @juliangruber said |
Yeah I do this now Promise.promisifyAll(http.Server.prototype)
...
let server = http.createServer(app.callback())
await server.listenAsync()
...
await server.closeAsync() This works, I'm just sick of promisifying everything. But maybe mz will add http one day. |
@felixfbecker works w/ bluebird :) |
Node's native listen() method takes a callback that gets executed once the server is ready. I expected the koa listen() to return a promise, but apparently it doesn't. This would be very helpful when setting up tests, for example in a mocha before hook, which understands promises:
This example of course would also work without async/await by returning the promise.
The text was updated successfully, but these errors were encountered: