You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This hasn't really been a problem, but now that we're adding docs for the types (#4011), it's going to become a source of confusion and broken links.
Describe the proposed solution
I think it makes more sense to rename the class than the namespace. The best suggestion so far is Server:
// created in build_server.jsexportclassServer{constructor(manifest){// ...}}
// created by an adapterimport{Server}from'SERVER';import{manifest}from'MANIFEST';constserver=newServer(manifest);// laterconstresponse=awaitserver.render(request);
At the risk of inviting bikeshedding, it might also make sense to change server.render to server.respond or server.handle or something, since 'render' sort of implies something side-effect free (which PUT/POST/DELETE requests aren't), and also implies that we're doing SSR when in some cases we're just rendering an empty shell page.
Aside: I've been meaning to overhaul Router and Renderer — having two separate classes seemed like a good idea at the time, but in practice it hasn't worked out, and it would make sense to unify them into a single class. There'd be a nice symmetry if we had a class Server and a class Client.
Alternatives considered
We could rename the namespace instead, though it's less clear what we could rename it to, and it would be a breaking change for more people (all Kit users rather than just adapter authors).
Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered:
server.respond() seems appropriate as it returns a Promise<Response>. :)
There'd be a nice symmetry if we had a class Server and a class Client.
It'd also be nice to have the server in a runtime/server/server.js with built data in the manifest à la the client. The less generated code, the easier to navigate the codebase, imo, unless strictly necessary.
Describe the problem
Internally, we have two things called
App
— the class that is created bysvelte-kit build
, and instantiated by adapters......and the namespace for specifying app-level interfaces like
locals
:This hasn't really been a problem, but now that we're adding docs for the types (#4011), it's going to become a source of confusion and broken links.
Describe the proposed solution
I think it makes more sense to rename the class than the namespace. The best suggestion so far is
Server
:At the risk of inviting bikeshedding, it might also make sense to change
server.render
toserver.respond
orserver.handle
or something, since 'render' sort of implies something side-effect free (which PUT/POST/DELETE requests aren't), and also implies that we're doing SSR when in some cases we're just rendering an empty shell page.Aside: I've been meaning to overhaul
Router
andRenderer
— having two separate classes seemed like a good idea at the time, but in practice it hasn't worked out, and it would make sense to unify them into a single class. There'd be a nice symmetry if we had aclass Server
and aclass Client
.Alternatives considered
We could rename the namespace instead, though it's less clear what we could rename it to, and it would be a breaking change for more people (all Kit users rather than just adapter authors).
Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered: