Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

koa-router-map

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-router-map

Koa middleware to expose routes list of a koa-router

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

Koa-router-map

Koa middleware to expose routes list of a koa-router.

You can find examples of how to use this library. You can also look at the tests scenarios in the tests directory to get running examples to use.

examples :

const Koa = require('koa')
const Router = require('koa-router')
const koaRouterMap = require('koa-router-map')

const router = new Router()

router.get('Get all Examples', '/examples', async function examplesHandler(ctx) {
    ctx.body = 'OK'
})

const app = new Koa()
app.use(koaRouterMap(router))
app.use(router.routes(), router.allowedMethods())
server = app.listen(3000)

Open your browser or curl : http://localhost:3000/routes/map

It should display :

alt text

Options

  • Color mode in terminal only : curl http://localhost:3000/routes/map?color=true alt text

  • Raw mode : GET http://localhost:3000/routes/map?raw=true alt text

Tests

To Launch the tests :

  • run : $ npm install
  • run : $ npm test
  • run : $ npm run watch : It launch test when you change the code

(The tests will run a koa app on port 9000 be sure that this port is available)

Code Coverage

After running $ npm test you can access the code coverage report here : ./coverage/index.html

Keywords

koa

FAQs

Package last updated on 10 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts