4 ms·
BunnySDK.net.http.serve(async (request: Request): Response | Promise<Response> => { return new Response("Hello World"); }); I love that pretty much all t
by apitman 2y ago
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/ https://blog.val.town/blog/the-api-we-forgot-to-name/
- plopz 2y agoThats new to me, is that an attempt to standardize similar to PHP's psr-7?
- laktek 2y agoI think the closest thing we got is the Default fetch export https://docs.deno.com/runtime/fundamentals/http_server/#default-fetch-export https://docs.deno.com/runtime/fundamentals/http_server/#defa..., which Cloudflare Workers, Deno Deploy and Supabase Edge Functions support.
- throwitaway1123 2y agoNode is the only major outlier. Bun supports this convention as well: https://bun.sh/docs/api/http#export-default-syntax https://bun.sh/docs/api/http#export-default-syntax
- apitman 2y agoI had no idea this was a thing. Thanks!
- diggan 2y agoI 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.
- deleted 2y ago[deleted]
- Onavo 2y agoIs Bunny fully WinterCG compatible?
- ascorbic 2y agoThe runtime is Deno, so yes.
- sgammon 2y agoCame here to say this