|
|
|
|
|
by bongobingo1
1344 days ago
|
|
I'm surprised to read that "Bun actually sits above a URL router capable of matching methods, URL wildcards and parameters". I thought bun was just a JS runtime, though I guess thinking about it maybe I don't even understand what a JS runtime is. I always figured nodejs is v8 + an stdlib. I think bun is a custom zig-js engine + an extended stdlib (website claims "batteries included")? Isn't the router generally "application/framework (i.e vue) specific"? Does stuff like Express or Nextjs not actually ship a webserver and just use the underlying "runtime"'s `http.serve` function? Is it possible to make an analogous "webbrick to unicorn" server swap while still running nodejs or are you swapping runtimes to do that? |
|
Any module system and dependency management is part of runtime (loading scripts, running them before executing code, etc).
Any other execution context such as workers or running wasm is also responsibility of runtime to implement and manage.
FFI or native extensions are also part of runtime. So one may use the built in networking APIs to build a server framework such as express or they may opt to bring their own networking layer through a native extension.
Frameworks such as express and next build on top of http node module.
Many of these APIs provided by runtime are also simply js scripts run in the global context before running your code.
Router is application specific, not part of any of the JS runtime but URL pattern can be used to build a router which is a standardized API implemented by both browsers and deno.
Runtime can choose to provide any API they want under their namespace so deno could provide a full blown router if they want to.
Does that clear it up?