Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

osprey-resources

Package Overview
Dependencies
Maintainers
3
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

osprey-resources

Automatically support RAML resources

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
1.1K
9.7%
Maintainers
3
Weekly downloads
 
Created
Source

Osprey Resources

NPM version NPM Downloads Build status Test coverage Greenkeeper badge

Iterate over RAML resources and generate a middleware router.

Installation

npm install osprey-resources --save

Usage

const express = require('express')
const resources = require('osprey-resources')
const utils = require('./utils')

const app = express()

// Array.<webapi-parser.EndPoint>
const endPoints = utils.getEndPoints()

app.use(resources(
  endPoints,
  function (method, path) {
    return function (req, res, next) {
      res.end('hello, world!')
    }
  }
))

The resources function accepts two arguments. The array of EndPoint objects from webapi-parser model and a function that will generate the route for that path. Return null if the route should not be used.

License

MIT license

FAQs

Package last updated on 28 Jul 2020

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