Skip to content

node.js REST framework specifically meant for web service APIs

License

Notifications You must be signed in to change notification settings

stueynz/node-restify

 
 

Repository files navigation

alt text

restify

Build Status Gitter chat Dependency Status devDependency Status bitHound Score NSP Status

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

Follow restify on alt text

Join us on IRC at irc.freenode.net in the #restify channel for real-time chat and support.

Usage

Server

const restify = require('restify');

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

server.use(restify.acceptParser(server.acceptable));
server.use(restify.queryParser());
server.use(restify.bodyParser());

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

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

Client

const assert = require('assert');
const restify = require('restify');

const client = restify.createJsonClient({
  url: 'http://localhost:8080',
  version: '~1.0'
});

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

Installation

$ npm install restify

License

The MIT License (MIT) Copyright (c) 2016 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 https://github.com/restify/node-restify/issues.

Contributing

restify has been broken out into a couple of different repositories. The repo here here contains only the core functionality of the server.

  • For plugins, please go here.
  • For the errors module, please go here.

Mailing list

See the Google group .

About

node.js REST framework specifically meant for web service APIs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 99.1%
  • Other 0.9%