@tuvix.js/router
v0.4.4
Published
Routing module for Tuvix.js microfrontend framework
Readme
@tuvix.js/router
URL routing for the Tuvix.js microfrontend framework
Part of the Tuvix.js microfrontend framework.
Installation
npm install @tuvix.js/routerQuick Start
import { createRouter } from '@tuvix.js/router';
const router = createRouter({ mode: 'history' });
router.addRoute({
path: '/dashboard',
name: 'dashboard',
});
router.onChange((event) => {
console.log('Route changed:', event.path);
});
router.start();API
createRouter(config?)— Create a new router instanceRouter— URL routing with history/hash modes, dynamic segments, route guardspathToRegex(path)— Convert a path pattern to a RegExpmatchRoute(path, routes)— Match a path against route configsparseQuery(queryString)— Parse URL query parametersnormalizePath(path)— Normalize a URL path
License
MIT
