call - Simple HTTP Router
Eran Hammer
Lead Maintainer -Introduction
call
is a simple node.js HTTP Router. It is used by popular hapi.js web framework. It implements predictable and easy to use routing. Even if it is designed to work with Hapi.js, you can still use it as an independent router in your app.
Example
const Call = ;// Create new routerconst router = ;// Add routerouter;// Add another routerouter;// Add another route with dynamic pathrouter;// Match routerouter;/* If matching route is found, it returns an object containing{params: {}, // All dynamic path parameters as key/valueparamsArray: [], // All dynamic path parameter values in orderroute: 'route specific data'; // routeData}*/// Match routerouter;/* returns{params: { userId: '1234' },paramsArray: [ '1234' ],route: [Function]}*/
API
See the detailed API Reference.