@buyerjourney/router

1.1.0 • Public • Published

bj-router

Lightweight Router in vanilla javascript for the BuyerJourneyJS project.

Sponsors

Features

  • Multiple routes with path and callback function.
  • Single page application routing using hash.
  • Parameters.
  • Query strings.
  • Referrer.
  • Set name on routes with setName(name) and retrieve the path with pathFor(name, parameters).
  • Error 404: Callback function included.
  • Error 404: Customizable Callback function.

Example

import { bjRouter } from  "@buyerjourney/router";
import { home, store, blog } from "./app/pages";

App = new bjRouter({ hashSensitive:true});
App.on('/', home);
App.on('#store/{product}', store);
App.on('#blog/{article}', blog);

App.run();

Documentation

License

bj-router is GPL-3.0-or-later.

Package Sidebar

Install

npm i @buyerjourney/router

Weekly Downloads

4

Version

1.1.0

License

GPL-3.0-or-later

Unpacked Size

69.9 kB

Total Files

7

Last publish

Collaborators

  • antoniofregoso