gitmyhub

node-restify

JavaScript ★ 11k updated 3d ago

The future of Node.js REST development

A Node.js framework for building REST APIs using a middleware chain pattern, plus a matching client library for making requests to REST endpoints from Node.js.

JavaScriptNode.jssetup: easycomplexity 3/5

Restify is a Node.js framework for building REST APIs. A REST API is a way for programs to communicate over the web by sending requests to specific URL paths and receiving structured responses, typically as JSON. Restify provides the server-side structure for defining those paths and handling incoming requests in a predictable, organized way.

The framework follows the same middleware pattern used by Connect, which means you build up behavior by chaining small functions together. Each function can inspect or modify the request before it reaches your handler, or modify the response before it goes back to the caller. The README shows the basic pattern: create a server, attach a few built-in plugins to parse query strings and request bodies, define a route with a URL pattern, and start listening on a port.

Restify also ships a client library (in a separate package called restify-clients) that you can use from Node.js to make requests to a restify server or to any other REST API. The client handles things like JSON parsing and version negotiation automatically.

Installation is a single npm command. At the time the README was written, the supported Node.js versions were 14.x and 16.x. The full documentation is at restify.com. There is also a separate errors module maintained by the same team, which provides structured error types you can return from your API handlers.

Restify is released under the MIT license. Issues are tracked in the GitHub repository, and there is a mailing list on Google Groups for broader discussion.

Where it fits