Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

  BunnySDK.net.http.serve(async (request: Request): Response | Promise<Response> => {
    return new Response("Hello World");
  });
I love that pretty much all the JS runtimes have settled on `(Request): Response`[0], but I really wish they would standardize starting the server as well. Would make writing cross-runtime services easier.

[0]: https://blog.val.town/blog/the-api-we-forgot-to-name/



I think the closest thing we got is the Default fetch export https://docs.deno.com/runtime/fundamentals/http_server/#defa..., which Cloudflare Workers, Deno Deploy and Supabase Edge Functions support.


Node is the only major outlier. Bun supports this convention as well: https://bun.sh/docs/api/http#export-default-syntax


I had no idea this was a thing. Thanks!


Is Bunny fully WinterCG compatible?


The runtime is Deno, so yes.


I wonder where the pattern first comes from? I think I either came across it in Express (JS) or Ring (Clojure) first but surely it was first done somewhere else.


Thats new to me, is that an attempt to standardize similar to PHP's psr-7?


Came here to say this




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: