File-Based Routing
InertJS uses an intuitive file-system based router. Every directory inside src/routes/ becomes a route, and its view.js file becomes the page.
Basic Routes
To create a new route, simply create a folder and add a view.js file:
src/routes/
├── view.js // Maps to /
├── about/
│ └── view.js // Maps to /about
└── contact/
└── view.js // Maps to /contact
Dynamic Routes
You can define dynamic route parameters by wrapping a directory name in square brackets, like [id] or [slug].
src/routes/
└── users/
└── [id]/
└── view.js // Maps to /users/1, /users/abc
Inside the view.js file, you can access the dynamic parameter in your flux() function:
export async function flux({ params }) {
const userId = params.id;
return { userId };
}

