UNPKG

4.28 kBMarkdownView Raw
1<!-- Please don't remove this: Grab your social icons from https://github.com/carlsednaoui/gitsocial -->
2
3<!-- display the social media buttons in your README -->
4
5[![alt text][1.1]][1]
6
7
8<!-- links to social media icons -->
9<!-- no need to change these -->
10
11<!-- icons with padding -->
12
13[1.1]: http://i.imgur.com/tXSoThF.png (twitter icon with padding)
14
15<!-- icons without padding -->
16
17[1.2]: http://i.imgur.com/wWzX9uB.png (twitter icon without padding)
18
19
20<!-- links to your social media accounts -->
21<!-- update these accordingly -->
22
23[1]: http://www.twitter.com/restifyjs
24
25<!-- Please don't remove this: Grab your social icons from https://github.com/carlsednaoui/gitsocial -->
26
27![restify](/../gh-images/logo/png/restify_logo_black_transp_288x288.png?raw=true "restify")
28
29[![Build Status](https://travis-ci.org/restify/node-restify.svg?branch=master)](https://travis-ci.org/restify/node-restify)
30[![Dependency Status](https://david-dm.org/restify/node-restify.svg)](https://david-dm.org/restify/node-restify)
31[![devDependency Status](https://david-dm.org/restify/node-restify/dev-status.svg)](https://david-dm.org/restify/node-restify#info=devDependencies)
32[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
33
34[restify](http://restify.com) is a framework, utilizing
35[connect](https://github.com/senchalabs/connect) style middleware for building
36REST APIs. For full details, see http://restify.com
37
38Follow restify on [![alt text][1.2]][1]
39
40# Usage
41
42## Server
43```javascript
44var restify = require('restify');
45
46const server = restify.createServer({
47 name: 'myapp',
48 version: '1.0.0'
49});
50
51server.use(restify.plugins.acceptParser(server.acceptable));
52server.use(restify.plugins.queryParser());
53server.use(restify.plugins.bodyParser());
54
55server.get('/echo/:name', function (req, res, next) {
56 res.send(req.params);
57 return next();
58});
59
60server.listen(8080, function () {
61 console.log('%s listening at %s', server.name, server.url);
62});
63```
64
65## Client
66```javascript
67var assert = require('assert');
68var clients = require('restify-clients');
69
70var client = clients.createJsonClient({
71 url: 'http://localhost:8080',
72 version: '~1.0'
73});
74
75client.get('/echo/mark', function (err, req, res, obj) {
76 assert.ifError(err);
77 console.log('Server returned: %j', obj);
78});
79```
80
81# Installation
82```bash
83$ npm install restify
84```
85
86## Supported Node Versions
87
88Restify aims to support the Node.js LTS (Active and Maintenance) versions along with Node.js current stable version.
89
90| Node Release | Supported in Current Version | Notes |
91| :--: | :---: | :---: |
92| 11.x | **Yes** | Current stable |
93| 10.x | **Yes** | Active LTS |
94| 8.x | **Yes** | Maintenance LTS |
95| 6.x | **No** | Use restify v7.x, team will backport critical issues only |
96| 4.x | **No** | Use restify v7.x, team will backport critical issues only |
97
98## License
99
100The MIT License (MIT)
101
102Copyright (c) 2018 restify
103
104Permission is hereby granted, free of charge, to any person obtaining a copy of
105this software and associated documentation files (the "Software"), to deal in
106the Software without restriction, including without limitation the rights to
107use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
108the Software, and to permit persons to whom the Software is furnished to do so,
109subject to the following conditions:
110
111The above copyright notice and this permission notice shall be included in all
112copies or substantial portions of the Software.
113
114THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
115IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
116FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
117AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
118LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
119OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
120SOFTWARE.
121
122## Bugs
123
124See <https://github.com/restify/node-restify/issues>.
125
126## Other repositories
127
128- For the errors module, please go [here](https://github.com/restify/errors).
129
130
131## Mailing list
132
133See the
134[Google group](https://groups.google.com/forum/?hl=en&fromgroups#!forum/restify)
135.