sholladay / pogo

Server framework for Deno
Mozilla Public License 2.0
482 stars 32 forks source link

[Bug] server.start never resolves despite successfully started #66

Closed KaKi87 closed 2 years ago

KaKi87 commented 2 years ago

Hello,

The code documented here won't work because the promise returned by server.start won't ever resolve, meanwhile, routes work.

Thanks

sholladay commented 2 years ago

This is an upstream issue with Deno, unfortunately. I'll document it.

https://github.com/denoland/deno_std/issues/2071

KaKi87 commented 1 year ago

Hello, I'm sorry to report that this issue wasn't fixed in v0.6.0, and I'm sorry that it took me this long to notice it. Thanks

sholladay commented 1 year ago

The upstream issue still exists, unfortunately, even though they decided to close it.

I suppose we could add on onListen callback to the server options, like they did in std/http. You'd still want to await server.start() so that errors would throw. And the callback doesn't really wait for anything internally. But at least you could run some code when the server is listening.

PR welcome for any implementation that follows the approach in std/http.