-
Notifications
You must be signed in to change notification settings - Fork 0
a7 Router
It's the router of a7JS and it is in it self pretty self explanatory.
Essentially it takes a route / path / URL inside your app. And when it routes to a given url it will show the page that you attached to it.
in order to get this setup completely you have to setup your server in a way that it would give the user the index.html
when a resource is not found
It is used to match URL where the starting bit until to the *
is the same and anything after it. For example
/users/*
would be matched with /users/bob
and /users/bob/likes
a7.routes({
"/route": component()
})
/* index.js */
import a7 from "a7js";
import homePage from "./components/homePage/homePage.js";
a7.routes({
//when user goes to homepage
"/home": homePage()
})
if you want it to go to homepage when no other route is found do the following
a7.routes({
//this matches every page which are not otherwise declared here in the routes
"/*": homePage()
})
if you would have different users in your app and you would show their profile with a following url example.com/users/username
this is the way you could do it
a7.routes({
"/users/*": userPage()
})
Join our discord discord.gg/388FREA