Slava
Slava•2d ago

Deno.serve vs serve (from @std/http/server.ts)

This is probably a newbie question, but why does deployment end with an error during the warm-up step when using serve from the standard library? As far as I understand, this happens due to a timeout because the server is listening on port 8000. But then why does Deno.serve deploy without any problems? Does this mean that they have different way of starting the server? If someone could explain this in detail, I would be very appreciated.
No description
No description
3 Replies
marvinh.
marvinh.•20h ago
The serve from the standard library was deprecated 3 years ago in favour of Deno.serve. It was finally removed from the standard library entirely a little more than a year ago. For that reason very little testing is done on that. As a rule of thumb: If you're importing anything from https://deno.land it's very likely that you're using outdated/abandoned code. The deno.land registry was replaced by the jsr.io registry 2 years ago. tl;dr: forget about anything from deno.land. Always use Deno.serve
Slava
SlavaOP•6h ago
Oh, I didn't know that. It seems that a year ago, when I was studying deno, it wasn't outdated yet 😄 thanks! I understand that this doesn't make sense, but if we assume why it might not work? I'm just curious what the problem is
marvinh.
marvinh.•6h ago
No idea why it doesn't work

Did you find this page helpful?