Advanced Routing Techniques
With everything we’ve covered so far, you could set this book down now and go build a simple website using SvelteKit. But if you wanted to build more advanced functionality into your application, you might find yourself struggling to come up with the proper hierarchies for routes. That’s because when it comes to dynamic routing, we’ve only scratched the surface. In Chapter 4, we discussed creating dynamic pages with parameters passed to our routes. In that example, we loaded articles by using the provided slug and matching it with those found in our demonstration database. We had no way of knowing what the slug would be ahead of time and it would have been needlessly complicated to create a new route for each article. Instead, we looked at the slug parameter that was received based on the URL being accessed.
This was only a brief introduction to dynamic routing. In this chapter, we’ll look at some more advanced techniques that...