Make adapters smaller and easier #16757
bobTheBuilder7
started this conversation in
Ideas
Replies: 1 comment
|
Hono already uses the same approach (I do understand that Hono and SvelteKit do completely separate things but still) import { Hono } from 'hono'
const app = new Hono()
app.get('/', (c) => c.text('Hello Deno!'))
Deno.serve(app.fetch)Bun import { Hono } from 'hono'
const app = new Hono()
app.get('/', (c) => c.text('Hello Bun!'))
Bun.serve(app.fetch)Vercel import { Hono } from 'hono'
const app = new Hono()
const welcomeStrings = [
'Hello Hono!',
'To learn more about Hono on Vercel, visit https://vercel.com/docs/frameworks/backend/hono',
]
app.get('/', (c) => {
return c.text(welcomeStrings.join('\n\n'))
})
export default appCloudflare Workers import { Hono } from 'hono'
const app = new Hono()
app.get('/', (c) => c.text('Hello Cloudflare Workers!'))
export default app |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Right now the node adapter forces everyone to use either polka or express. I think that it might be a good idea to make SvelteKit runtime agnostic. The current approach with different adapters is supposed to do that but the burden is on library maintainers to keep them updated for each framework and that makes using SvelteKit with Deno or Bun an unpleasant experience.
I think it might be a good approach that after building the project,
build/index.jsexported something like anappobject with afetchfunction that has the following type(Request) => Response | Promise<Response>. This would make SvelteKit easy to integrate with any current or future runtimes.It would help end users of different runtimes to use the built project like this:
Deno:
Bun:
A few things to consider:
node:*packages that are either not available or not the recommended to be used because of better alternatives.A possible solution might be for the end user to bring the fs interaction, that way SvelteKit stays agnostic.
As far as I know they already support this kind of behavior. But I might be wrong.
Why I think this is important?
(Request) => Response | Promise<Response>.I would love to hear everyone's feedback on this!
All reactions