3 ms·
SvelteKit is really, really great for small to medium sized projects. The amount of stuff you get "for free" (prerendering, ssr, decent SEO) by using SvelteKit
by Pepe1vo 3y ago
SvelteKit is really, really great for small to medium sized projects. The amount of stuff you get "for free" (prerendering, ssr, decent SEO) by using SvelteKit is so nice.
That being said, I definitely agree with the sentiment here that the file based routing is sub-optimal and I think the hurt goes up exponentially with the size of a project. I've also found that straying off the opinionated path even a little gets you in all sorts of trouble almost immediately. For me it was trying to add a SvelteKit app to an existing Nx codebase, did manage to make it work in the end luckily.
Btw, if anyone has found a good solution for creating an OpenAPI spec for SvelteKit server routes, let me know. :)
- jFriedensreich 3y agothis is exactly what i am thinking. i ended up building my own router that tries to use an openAPI schema as the sole source of truth but pre-populates the schema based on folder structure so that simple setups behave nearly identical to file based routers. the difference is that you can drop pre-populated routes when the app gets more complex and gradually move to a schema based approach and do things like extract more complex data from url, validation and reuse pages at different places etc.
- Pepe1vo 3y agoSounds cool! If you have any code you're willing to share, I'd love to take a look :)
- Glench 3y ago> That being said, I definitely agree with the sentiment here that the file based routing is sub-optimal Not sure if you're talking about the article, but I'm the author and I love file-based routing. I think it's an exceptionally good idea that makes it so much easier to figure out where code lives. Haven't yet run into an issue that makes it "sub-optimal" like you said, but SvelteKit's node adapter does make it so you can set any routes you want with plain old Express.