@involves/express-router-tool
v1.0.62
Published
[![Build status](https://badge.buildkite.com/2dc4efbbcbe4162ff6abaad8992933a1566c94165ddb11dee4.svg)](https://buildkite.com/involves/nodejs-lib-express-router-tool) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=involvest
Downloads
155
Readme
@invovles/express-router-tool
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