@involves/express-router-tool

1.0.62 • Public • Published

@invovles/express-router-tool

Build status Quality Gate Status

Install

npm install @involves/express-router-tool --save

Example usage

Router tool:

const express = require('express')
const { routerTool } = require('@involves/express-router-tool')

async function _controller(_req, res) {
  res.end()
}

(() => {
  const app = express()
  const router = express.Router()
  const ROUTE = '/'

  routerTool.create(router, 'GET', ROUTE, _controller)
})()

Default errors:

const { UnauthorizedError } = require('@involves/express-router-tool')

async function _controller(_req, res) {
  throw new UnauthorizedError()
}

List of Errors

Error Status Code
BadRequestError 400
ServiceUnavailableError 503
UnauthorizedError 401
ValidationError 400

How to run the tests

At the terminal, just type the command:

npm run test

/@involves/express-router-tool/

    Package Sidebar

    Install

    npm i @involves/express-router-tool

    Weekly Downloads

    28

    Version

    1.0.62

    License

    ISC

    Unpacked Size

    14.5 kB

    Total Files

    18

    Last publish

    Collaborators

    • iotbernardes