Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey committed Jan 28, 2015
0 parents commit 25f2a50
Show file tree
Hide file tree
Showing 10 changed files with 1,419 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# EditorConfig is awesome: http://EditorConfig.org

root = true

[*]
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
bower_components
coverage
.DS_Store
npm-debug.log
3 changes: 3 additions & 0 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
bower_components
coverage
27 changes: 27 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"maxerr": 100, // Maximum errors before stopping.
"maxlen": 80, // Maximum line length.
"quotmark": "single", // Consistent quotation mark usage.
"bitwise": false, // Prohibit bitwise operators (&, |, ^, etc.).
"curly": true, // Require {} for every new block or scope.
"eqeqeq": true, // Require triple equals i.e. `===`.
"forin": false, // Tolerate `for in` loops without `hasOwnPrototype`.
"immed": true, // Require immediate invocations to be wrapped in parens. E.g. `(function(){})();`.
"latedef": false, // Prohibit variable use before definition.
"newcap": true, // Require capitalization of all constructor functions. E.g. `new F()`.
"noarg": true, // Prohibit use of `arguments.caller` and `arguments.callee`.
"noempty": true, // Prohibit use of empty blocks.
"nonew": true, // Prohibit use of constructors for side-effects.
"undef": true, // Require all non-global variables be declared before they are used.
"unused": true, // Warn when creating a variable but never using it.
"plusplus": false, // Prohibit use of `++` & `--`.
"regexp": false, // Prohibit `.` and `[^...]` in regular expressions.
"strict": false, // Require `use strict` pragma in every file.
"trailing": true, // Prohibit trailing whitespaces.
"boss": true, // Tolerate assignments inside if, for and while. Usually conditions and loops are for comparison, not assignments.
"multistr": false, // Prohibit the use of multi-line strings.
"eqnull": true, // Tolerate use of `== null`.
"expr": true, // Tolerate `ExpressionStatement` as Programs.
"node": true, // Support globals used in a node environment.
"browser": true // Support globals used in a browser environment.
}
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: node_js

notifications:
email:
on_success: never
on_failure: change

node_js:
- "0.10"

after_script: "npm install coveralls@2 && cat ./coverage/lcov.info | coveralls"
13 changes: 13 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2015 (c) MuleSoft, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific
language governing permissions and limitations under the License.
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Osprey Method Handler

[![NPM version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]

Middleware for validating requests and responses based on a [RAML method](https://github.com/raml-org/raml-spec/blob/master/raml-0.8.md#methods) object.

## Installation

```sh
npm install osprey-method-handler --save
```

## Usage

```js
var express = require('express');
var handler = require('osprey-method-handler');

express.post('/users', handler({
headers: {},
responses: {
'200': {
body: {
'application/json': {
schema: '...',
example: '...'
}
}
}
},
body: {
'application/json': {
schema: '...'
}
}
}), function (req, res) {
res.send('it worked!');
});
```

## License

MIT license

[npm-image]: https://img.shields.io/npm/v/osprey-method-handler.svg?style=flat
[npm-url]: https://npmjs.org/package/osprey-method-handler
[downloads-image]: https://img.shields.io/npm/dm/osprey-method-handler.svg?style=flat
[downloads-url]: https://npmjs.org/package/osprey-method-handler
[travis-image]: https://img.shields.io/travis/mulesoft-labs/osprey-method-handler.svg?style=flat
[travis-url]: https://travis-ci.org/mulesoft-labs/osprey-method-handler
[coveralls-image]: https://img.shields.io/coveralls/mulesoft-labs/osprey-method-handler.svg?style=flat
[coveralls-url]: https://coveralls.io/r/mulesoft-labs/osprey-method-handler?branch=master
Loading

0 comments on commit 25f2a50

Please sign in to comment.