node-restify README

The project's README from github.com/restify/node-restify. As one markdown file: README.md.

alt text

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

Usage

Server

var restify = require('restify');

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

server.use(restify.plugins.acceptParser(server.acceptable));
server.use(restify.plugins.queryParser());
server.use(restify.plugins.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

var assert = require('assert');
var clients = require('restify-clients');

var client = clients.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

Supported Node Versions

Restify currently works on Node.js v22.x, v24.x and v26.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 https://github.com/restify/node-restify/issues.

Other repositories

Mailing list

See the Google group .

node-restify (restify/node-restify)

Searching Database…

这是什么?restify 是一个 Node.js 框架,用于借助 connect 风格的中间件构建 REST API。
它是框架还是库?它是一个用于构建服务器的框架,另外附带一个可选的 HTTP 客户端,其设计参照了 connect/express 的中间件模式。
怎样把它添加到项目中?通过 npm 将其作为依赖项安装,然后使用 'restify.createServer()' 创建服务器,并用 '.get()' 或 '.post()' 等方法定义路由。
我需要哪个 Node.js 版本?Restify 目前支持 Node.js v22.x、v24.x 和 v26.x。
restify 和 Express 有什么不同?Restify 专为 REST API 而设计(而非通用网页应用或视图),内置 DTrace 支持,自带专用 HTTP 客户端,其 connect 风格的中间件专注于 API 语义,而不是模板或页面渲染。
它包含 HTTP 客户端,还是只有服务器?是的,restify 同时提供用于构建 API 的服务器框架和用于调用 API 的内置 HTTP 客户端。
错误类是这个仓库的一部分吗?不是,restify 所用的 errors 模块位于另一个独立的仓库中。
What are similar projects?express, koa, martini, apollo-server, sails, hapi, echo, multer
Creator
restify
Size
4.5 MB
Stars
10.7K
Age
15y
Commits · 90 Days