diff --git a/README.md b/README.md index e9f0c4d..06835d8 100644 --- a/README.md +++ b/README.md @@ -172,6 +172,25 @@ app.post('/users/{userId}', function (req, res, next) { All parameters are automatically validated and parsed to the correct types according to the RAML document using [raml-validate](https://github.com/mulesoft/node-raml-validate) and [raml-sanitize](https://github.com/mulesoft/node-raml-sanitize). URL parameter validation comes with [Osprey Router](https://github.com/mulesoft-labs/osprey-router), available using `osprey.Router`. +```js +// Similar to `express.Router`, but uses RAML paths. +var Router = require('osprey').Router + +var app = new Router() + +app.use(...) + +app.get('/{slug}', { + slug: { + type: 'string' + } +}, function (req, res) { + res.send('success') +}) + +module.exports = app +``` + #### Handling Errors Osprey returns a [middleware router instance](https://github.com/pillarjs/router), so you can mount this within any compatible application and handle errors with the framework. For example, using HTTP with [finalhandler](https://github.com/pillarjs/finalhandler) (the same module Express uses): diff --git a/package.json b/package.json index 35f7feb..cfb1bf7 100644 --- a/package.json +++ b/package.json @@ -55,8 +55,8 @@ "invariant": "^2.1.0", "oauth2orize": "^1.0.1", "osprey-method-handler": "^0.10.0", - "osprey-resources": "^0.4.0", - "osprey-router": "^0.1.1", + "osprey-resources": "^0.5.0", + "osprey-router": "^0.2.0", "parseurl": "^1.3.0", "passport": "^0.3.0", "passport-http": "^0.3.0", @@ -81,6 +81,6 @@ "popsicle-server": "^1.0.0", "pre-commit": "^1.0.5", "server-address": "^1.0.1", - "standard": "^5.0.0" + "standard": "^6.0.4" } }