Restify

The future of Node.js REST development

README




[![alt text][1.1]][1]







[1.1]: http://i.imgur.com/tXSoThF.png (twitter icon with padding)



[1.2]: http://i.imgur.com/wWzX9uB.png (twitter icon without padding)





[1]: http://www.twitter.com/restifyjs



restify
Build Status Dependency Status devDependency Status code style: prettier

restify is a framework, utilizing
connect style middleware for building
REST APIs.  For full details, see http://restify.com

Follow restify on [![alt text][1.2]][1]

Usage


Server

  1. ``` js
  2. var restify = require('restify');

  3. const server = restify.createServer({
  4.   name: 'myapp',
  5.   version: '1.0.0'
  6. });

  7. server.use(restify.plugins.acceptParser(server.acceptable));
  8. server.use(restify.plugins.queryParser());
  9. server.use(restify.plugins.bodyParser());

  10. server.get('/echo/:name', function (req, res, next) {
  11.   res.send(req.params);
  12.   return next();
  13. });

  14. server.listen(8080, function () {
  15.   console.log('%s listening at %s', server.name, server.url);
  16. });
  17. ```

Client

  1. ``` js
  2. var assert = require('assert');
  3. var clients = require('restify-clients');

  4. var client = clients.createJsonClient({
  5.   url: 'http://localhost:8080',
  6.   version: '~1.0'
  7. });

  8. client.get('/echo/mark', function (err, req, res, obj) {
  9.   assert.ifError(err);
  10.   console.log('Server returned: %j', obj);
  11. });
  12. ```

Installation

  1. ``` sh
  2. $ npm install restify
  3. ```

Supported Node Versions


Restify currently works on Node.js v14.x and v16.x.

License


The MIT License (MIT)

Copyright (c) 2018 restify

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Bugs


See .

Other repositories


- For the errors module, please go here.


Mailing list


See the
.