Lightweight JavaScript router
npm install @rootgog/routerhtml
`
Start Configuring routes
`javascript
//define an account router for use later
let accountRouter = new Router();
accountRouter
.on(() => {
setPageContent("account.html");
})
.on("edit", () => {
setPageContent("accountedit.html");
});
//define the main router
let router = new Router();
router
.on(() => {
setPageContent("home.html");
})
.on("account", accountRouter)
.on("post/*/edit", () => {
setPageContent("editpost.html");
})
.notFound(() => {
setPageContent("404.html");
});
`
Redirecting users
This will use the handler that was configured before
`javascript
Router.sendTo("account");
``