Filesystem Routing

By default vite-plugin-ssr does Filesystem Routing: the URL of a page is determined based on where its .page.js file is located.

FILESYSTEM                        URL              COMMENT
pages/               /about
pages/index/         /                (`index` is mapped to the empty string)
pages/               /HELLO           (Mapping is case sensitive)

The directories pages/, src/, and index/ are mapped to the empty string ''. For example:

FILESYSTEM                                      URL
src/pages/jobs/                    /jobs
pages/pages/src/src/index/pages/   /about

Which allows us to have a domain-driven file structure such as:

FILESYSTEM                        URL
user/pages/           /user/list
user/pages/         /user/create
todo/pages/           /todo/list
todo/pages/         /todo/create

We can also change the URL root of Filesystem Routing with

For more advanced routing, we use Route Strings and Route Functions.