8000 GitHub - Peter-LaComb/osprey-resources: Automatically support RAML resources
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Peter-LaComb/osprey-resources

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Osprey Resources

NPM version NPM Downloads Build status Test coverage

Iterate over RAML resources and generate a middleware router.

Installation

npm install osprey-resources --save

Usage

var express = require('express');
var resources = require('osprey-resources');
var app = express();

app.use(resources(
  [{
    relativeUri: '/users',
    methods: [{
      method: 'post',
      body: {
        'application/json': {
          schema: '...'
        }
      }
    }]
  }],
  function (method, path) {
    return function (req, res, next) {
      res.end('hello, world!')
    }
  }
));

The resources function accepts two arguments. The array of resources from RAML and a function that will generate the route for that path. Return null if the route should not be used.

License

MIT license

About

Automatically support RAML resources

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%
0