Bragg Router is a routing middleware specifically crafted for the `bragg` AWS Lambda web framework. It empowers developers to define HTTP routes for serverless functions using a familiar Koa-inspired interface. Routes can handle various HTTP methods (GET, POST, PUT, DELETE, PATCH, HEAD, UPDATE) and support URL parameter matching based on the `matcher` library. A key feature is the ability to chain multiple middleware functions for a single route, processing them sequentially and resolving promises between steps. The current stable version is 2.1.0, released in 2020. As a specialized router for the `bragg` framework, it differentiates itself by providing a concise and functional API tailored for AWS Lambda environments, in contrast to broader Node.js web frameworks. However, the `bragg` ecosystem and `bragg-router` itself appear to be in an unmaintained state, with no new feature development or consistent release cadence since 2021.
npm install bragg-routerVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize `bragg-router`, define simple and parameterized GET routes, implement a route with multiple asynchronous handlers, and integrate the router's middleware into a `bragg` application for AWS Lambda.
For module import, use the CommonJS `require()` syntax: `const router = require('bragg-router')();`Evaluate long-term suitability for new projects. Consider actively maintained alternatives if continuous updates, modern features, or security patching are critical. For existing projects, pin exact versions and conduct thorough security audits.
Change the import statement to CommonJS `require()`: `const router = require('bragg-router')();`Ensure `router.routes()` is called to return the middleware function: `app.use(router.routes());`