Projects /

Project overview

route-core

A route matcher that returns a numeric destination for the host to dispatch.

Use cases and boundaries

It fits framework or adapter authors who want to keep lookup separate from handler execution. Register method and path patterns and receive a storeId, captured parameters and the route template. The host maps the ID to a handler and handles authentication, response rendering and error policy.

Getting started and compatibility

Install the released package

npm install route-core@0.0.8

Node.js 18+. The package does route lookup and allowed-method queries. The host must normalize inputs according to its own URL and HTTP policy.

import { createRouter } from 'route-core';
const router = createRouter();
router.add('GET', '/reports/:id', 4);
console.log(router.find('GET', '/reports/17'));
// storeId: 4, params: { id: '17' }, routePath: '/reports/:id'

Project relationships