krasimir / navigo

A simple vanilla JavaScript router.
MIT License
2.75k stars 250 forks source link

Question/FeatureRequest: Ignore routes #299

Open meodai opened 3 years ago

meodai commented 3 years ago

I am working on a website that is static but I want to use the router for the blog part. (On the client/browser side) I have a single shared JS file. I figured the following would ignore all routes that are not /blog:

const router = new Navigo('/blog');
router.on('/:title', ({ data }) => {
  console.log(data.title)
});
router.resolve();

but it still throws an error catches mydmain.whatever/admin/ for example. Any idea how to solve that? Am I doing something wrong?