Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bearded-route-list

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bearded-route-list

> I just want to know what the hell I'm doing

  • 0.1.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

#Bearded Route List

I just want to know what the hell I'm doing

This attaches the express.Router() instance to given endpoints inside of routes along with building a list of all available endpoints along with the methods. See Example for use case and sample output

##Usage

yarn add bearded-route-list

##Import/Require

import baseList from 'bearded-route-list'

// OR

const baseList = require('bearded-route-list')

##Example

// Import the package
import baseList from 'bearded-route-list'

// Create routes/handlers
const UserRoute = express.Router(),
      AuthRoute = express.Router(),
      app = express()

// ...
// add endpoints to route
// ...

const routes = [
  {
    path: '/users',
    handler: UserRoute
  },
  {
    path: '/auth',
    handler: AuthRoute
  }
]

baseList(routes,app) // this will hook into the route '/'

// OR

baseList(routes, app, '/list') // this will hook into route '/list'

And going to '/' will return this:

{
  "/auth": {
    "/login": {
      "methods": {
        "post": true
      }
    }
  },
  "/users": {
    "/": {
      "methods": {
        "get": true,
        "post": true
      }
    },
    "/:_id": {
      "methods": {
        "delete": true,
        "get": true,
        "patch": true
      }
    }
  }
}

##Description

(routes = [], app, base = '/')

With routes being an array of objects with the following syntax:

{
  path: String,
  handler: express.Router()
}

App being an express() instance

base being the route you want the list of endpoints to be at.

FAQs

Package last updated on 26 Jan 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc