-
Hello, this is more of a doubt. So when I call this: // ...
app.listen(3000)) .. a promise is returned, and even if I wait for it: await app.listen(3000)) the next line is executed immediately. My question is, how can I wait until the server is stopped to finish closing other resources? try {
//...
await app.listen(3000))
// ==> should be waiting here somehow until server stops listening; e.g.
await app.closed()
} finally (e) {
// cleaning up resources
databasePool.close()
app.close()
} Thanks |
Beta Was this translation helpful? Give feedback.
Answered by
dalisoft
Jul 24, 2021
Replies: 1 comment 2 replies
-
Hi @howesteve
|
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
dalisoft
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @howesteve
Thank you for asking these questions, but it's not bug.
app.closed()
methodapp.listen()
async/promise works properly, testedapp.close()
method code is here