Name: js-handler/node_modules/restify/README.md
| 1: | # restify |
| 2: | |
| 3: | [](https://travis-ci.org/mcavage/node-restify) |
| 4: | |
| 5: | [restify](http://mcavage.github.com/node-restify) is a smallish framework, |
| 6: | similar to [express](http://expressjs.com) for building REST APIs. For full |
| 7: | details, see http://mcavage.github.com/node-restify. |
| 8: | |
| 9: | # Usage |
| 10: | |
| 11: | ## Server |
| 12: | |
| 13: | var restify = require('restify'); |
| 14: | |
| 15: | var server = restify.createServer({ |
| 16: | name: 'myapp', |
| 17: | version: '1.0.0' |
| 18: | }); |
| 19: | server.use(restify.acceptParser(server.acceptable)); |
| 20: | server.use(restify.queryParser()); |
| 21: | server.use(restify.bodyParser()); |
| 22: | |
| 23: | server.get('/echo/:name', function (req, res, next) { |
| 24: | res.send(req.params); |
| 25: | return next(); |
| 26: | }); |
| 27: | |
| 28: | server.listen(8080, function () { |
| 29: | console.log('%s listening at %s', server.name, server.url); |
| 30: | }); |
| 31: | |
| 32: | ## Client |
| 33: | |
| 34: | var assert = require('assert'); |
| 35: | var restify = require('restify'); |
| 36: | |
| 37: | var client = restify.createJsonClient({ |
| 38: | url: 'http://localhost:8080', |
| 39: | version: '~1.0' |
| 40: | }); |
| 41: | |
| 42: | client.get('/echo/mark', function (err, req, res, obj) { |
| 43: | assert.ifError(err); |
| 44: | console.log('Server returned: %j', obj); |
| 45: | }); |
| 46: | |
| 47: | # Installation |
| 48: | |
| 49: | $ npm install restify |
| 50: | |
| 51: | ## License |
| 52: | |
| 53: | The MIT License (MIT) |
| 54: | Copyright (c) 2012 Mark Cavage |
| 55: | |
| 56: | Permission is hereby granted, free of charge, to any person obtaining a copy of |
| 57: | this software and associated documentation files (the "Software"), to deal in |
| 58: | the Software without restriction, including without limitation the rights to |
| 59: | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of |
| 60: | the Software, and to permit persons to whom the Software is furnished to do so, |
| 61: | subject to the following conditions: |
| 62: | |
| 63: | The above copyright notice and this permission notice shall be included in all |
| 64: | copies or substantial portions of the Software. |
| 65: | |
| 66: | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 67: | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 68: | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 69: | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 70: | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 71: | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 72: | SOFTWARE. |
| 73: | |
| 74: | ## Bugs |
| 75: | |
| 76: | See <https://github.com/mcavage/node-restify/issues>. |
| 77: | |
| 78: | ## Mailing list |
| 79: | |
| 80: | See the |
| 81: | [Google group](https://groups.google.com/forum/?hl=en&fromgroups#!forum/restify) |
| 82: | . |
