Add a Route to a SvelteKit Application

InstructorBen Patton

Share this video with your friends

Send Tweet

A route is very simple to create in SvelteKit. Using 'file-based routing' you simply add a .svelte file (posts.svelte) in the routes folder. Then we can navigate to where our app is running. In this case, we go to localhost:4000/posts.

The index.svelte file can be thought of as the home route which evaluates to localhost:4000.

We will see more types of routes as we go along.