Open lamualfa opened 4 years ago
It's not clear here what you're trying to achieve. Do you have a concrete example?
To create a server route in Sapper, you can just add a js
file in the routes directory.
@antony You could see it as "page support for custom routers". Currently you can have "api routes" with .js
but it's not possible to render a page component like that.
Usecases:
One challenge is that the naive solution would only allow SSR because this custom routing logic is not available client-side. (could be a feature)
Is your feature request related to a problem? Please describe.
Small applications that use the concept of monoliths often use the API server, Frontend server and other logic in a single project. I have a little trouble to do the separation of the many routes if using the file routing concept.
Describe the solution you'd like
in Next JS, we can create a custom server using anything (like Fastify, Express, Koa, etc), then create a special handler that is used to render the React page. Next JS has its own render method which can be called from anywhere. Does Sapper have a plan to implement the same to render a Svelte page?
Example using render method in NextJS :
How important is this feature to you?
I am a Fastify user. I have a little trouble integrating the two. Fastify uses a quite different concept from Express to route them, so I need a render function that can be called from any route.