{"library":"rou3","title":"rou3 Router","description":"rou3 is a lightweight and fast JavaScript router, currently at version 0.8.1. It provides efficient routing capabilities for various JavaScript environments including Node.js, Bun, Deno, and browsers. The library is actively maintained with frequent minor releases and bug fixes, often including performance enhancements and type improvements, as seen in recent versions like 0.8.0 and 0.7.12. Key differentiators include its URLPattern-compatible syntax for defining routes, support for complex patterns like named wildcards, optional parameters, and custom regex, as well as features for escaping special characters in paths. It ships with TypeScript types, ensuring a robust developer experience for typed applications.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install rou3"],"cli":null},"imports":["import { createRouter } from 'rou3';","import { addRoute } from 'rou3';","import { findRoute } from 'rou3';","import type { InferRouteParams } from 'rou3';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { createRouter, addRoute, findRoute } from 'rou3';\n\nconst router = createRouter();\n\n// Add various route types\naddRoute(router, 'GET', '/users', { handler: 'listUsers' });\naddRoute(router, 'POST', '/users/:id', { handler: 'createUser' });\naddRoute(router, 'GET', '/posts/:category/:slug', { handler: 'viewPost' });\naddRoute(router, 'GET', '/files/**:path', { handler: 'serveStatic' });\n\n// Match routes and extract parameters\nconsole.log('GET /users:', findRoute(router, 'GET', '/users'));\n// Expected: { handler: 'listUsers' }\n\nconsole.log('POST /users/123:', findRoute(router, 'POST', '/users/123'));\n// Expected: { handler: 'createUser', params: { id: '123' } }\n\nconsole.log('GET /posts/tech/my-article:', findRoute(router, 'GET', '/posts/tech/my-article'));\n// Expected: { handler: 'viewPost', params: { category: 'tech', slug: 'my-article' } }\n\nconsole.log('GET /files/images/logo.png:', findRoute(router, 'GET', '/files/images/logo.png'));\n// Expected: { handler: 'serveStatic', params: { path: 'images/logo.png' } }\n\nconsole.log('GET /not-found:', findRoute(router, 'GET', '/not-found'));\n// Expected: undefined","lang":"typescript","description":"Demonstrates creating a router, adding various route patterns including parameters and wildcards, and then using `findRoute` to match incoming requests and extract associated data and parameters.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}