server-router is a Node.js HTTP router designed for streaming servers, leveraging a radix-trie data structure for high-performance route matching. It provides a concise API for defining routes with HTTP methods, including support for route parameters and wildcard paths. The current stable version is 6.1.0. Given its "experimental" stability rating as indicated by its documentation, its release cadence is irregular and breaking changes are possible without strict adherence to semantic versioning. It differentiates itself by focusing on server-side streaming applications and efficient routing, contrasting with client-side alternatives like nanorouter or more general-purpose routing solutions, by offering a low-level, performant foundation. It is suitable for applications where minimal overhead and direct HTTP stream handling are critical.
npm install server-routerVerified import paths — ran on the pinned version, not inferred.
Demonstrates setting up a basic HTTP server with multiple routes using GET, PUT, and combined methods, including a 404 handler and dynamic parameter extraction.
Monitor GitHub repository and npm releases for potential changes when upgrading. Consider locking to specific versions or thorough testing before deploying to production.
Always use `res.statusCode = <CODE>` to set the HTTP status, e.g., `res.statusCode = 404;`.
Ensure your project uses `require()` for importing `server-router` or configure a build step (e.g., with Babel or TypeScript) to transpile ESM imports to CJS.
Run `npm install server-router` or `yarn add server-router` in your project directory.
Change `res.status = 404` to `res.statusCode = 404`.
No dependency data recorded yet.