@lykmapipo/express-router-extra

Handy express router extensions

Stats

StarsIssuesVersionUpdatedCreatedSize
@lykmapipo/express-router-extra
500.6.12 months ago4 years agoMinified + gzip package size for @lykmapipo/express-router-extra in KB

Readme

express-router-extra

Build Status Dependencies Status Coverage Status GitHub License

Commitizen Friendly code style: prettier Code Style npm version

Handy express router extensions.

Requirements

  • NodeJS v9.3.0+

Install

$ npm install --save @lykmapipo/express-router-extra

Usage

import express from 'express';
import { Router } from '@lykmapipo/express-router-extra';

// instantiate a router
const router = new Router({prefix: 'v', version: 1});
router.get('/users', ...); // GET /v1.0.0/users
router.post('/users', ...); // GET /v1.0.0/users
router.get('/users/:id', ...); // GET /v1.0.0/users/:id
router.put('/users/:id', ...); // PUT /v1.0.0/users/:id
router.patch('/users/:id', ...); // PATCH /v1.0.0/users/:id
router.delete('/users/:id', ...); // DELETE /v1.0.0/users/:id

// mount router into app
router.mountInto(app);

app.listen(3000);

Test mounted path(s)

GET /v1.0.0/users HTTP/1.1
Authorization: Bearer <token>
Accept: application/json

Testing

  • Clone this repository

  • Install all development dependencies

    $ npm install
    
  • Then run test

    $ npm test
    

Contribute

It will be nice, if you open an issue first so that we can know what is going on, then, fork this repo and push in your ideas. Do not forget to add a bit of test(s) of what value you adding.

Licence

The MIT License (MIT)

Copyright (c) lykmapipo & Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.