Skip to main content
Version: 2.0.5

Static routes

Static routes are routes that will always have the same path and can be accessed from anywhere in the application.

You can use a static route using the method addRoute() of your router instance. To know more about the addRoute method you can read API/addRoute.

Code example

For this example we will add a new route in /books/history to show all history books.

src/index.js
import Router from "yourrouter";

const router = Router.get();

// add the route /books/history
router.addRoute("/books/history", () => {
console.log("You are in the history category!");
});