diff --git a/src/http.js b/src/http.js index 6541630..d661047 100644 --- a/src/http.js +++ b/src/http.js @@ -117,8 +117,7 @@ module.exports = ({ host, port, middleware, allowHost }) => { const server = app.listen({ host, port }); - // `server.address()` returns null unless you wait until the next tick. - setImmediate(() => { + server.on("listening", () => { const address = server.address(); if (typeof address === "string") {