Course lesson

Add a Route to a SvelteKit Application

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.

Duration
3 min
Access
Included
Transcript
Retained from source evidence

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.