{"repo":"lirantal/express-version-route","free":true,"listed":false,"github":"https://github.com/lirantal/express-version-route","clone":"git clone https://github.com/lirantal/express-version-route.git","description":"A Node.js express middleware that implements API versioning for route controllers","language":"JavaScript","stars":90,"topics":["api-versioning","expessjs","expressjs-middleware","nodejs","api"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"express-version-route This npm package provides an Express middleware to load route controllers based on api versions. Implementing API Versioning as simple as: now any request would be handled with the appropriate route handler in accordance to request.version . Usage Create a map where the key is the version of the supported controller, and the value is a regular Express route function signature. Then, on the route which you wish to version, call the route function of this module with the map you created: If no route matches the version requested by a client then the next middleware in the chain will be called. To set a route fallback incase no version matches set a 'default' key on the routes map, for example: If maximal possible version (for example to get the latest bugfix) is necessary, then please specify useMaxVersion: true in route function, then the maximal possible version will be returned for your request. For example for 1.0 request, the version 1.0.2 will be returned: Usage with TypeScript How it works The Library A requested version from the client must be available on the request object at req.version . You are encouraged to use this module's twin: express-version-request which is another simple Express middleware that populates req.version from the client's X-Api-Version header, Accept header or from a query string (such as 'api-version=1.0.0') The key for the routes versions you define can be a non-semver format, for example: 1.0 or just 1 . Under the hood, ","default_branch":null,"files":null,"tree":[],"storefront":"/r/lirantal","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/lirantal/express-version-route/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}