osprey-resources

1.0.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i osprey-resources

Weekly Downloads

513

Version

1.0.0

License

Apache-2.0

Unpacked Size

5.26 kB

Total Files

4

Last publish

Collaborators

  • cesaraugustogarcia
  • jstoiko
  • mulesoft-npm