The future of Node.js REST development

Overview

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 aims to support the Node.js LTS (Active and Maintenance) versions along with Node.js current stable version.

Node Release Supported in Current Version Notes
11.x Yes Current stable
10.x Yes Active LTS
8.x Yes Maintenance LTS
6.x No Use restify v7.x, team will backport critical issues only
4.x No Use restify v7.x, team will backport critical issues only

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

  • For the errors module, please go here.

Mailing list

See the Google group .

Comments
  • Automatic OPTIONS responses were removed

    Automatic OPTIONS responses were removed

    A recent checkin (d1366f2f860d0c1804fe74db1774eecf482d3ebf) stopped Restify's auto handling of OPTIONS requests. We now have the ability to create them manually.

    Although more control is good, manually adding OPTIONS for every endpoint is cumbersome and (if your application relies on CORS requests) can make it hard to move to Restify v2.

    I propose that the auto generated OPTIONS responses are "on by default" and developers can override the default by specifying server.opts(...). It would probably also be good to have a way to globally disable them.

    opened by williamkapke 35
  • performance, 4x slower that raw node http server?

    performance, 4x slower that raw node http server?

    Hi, I'd like to use node-restify in my project, but simple benchmark shows it's about 4x slower than raw node server. I had about 4k rps for restify and 12-13k for raw node (I used cluster to utilze all cpu cores). I know 4k is not bad, but I need very high throughput api. Are there any options in restify I could turn off to get better perf ?(I've turned off md5 hashing, but don't know what else I could turn off)

    opened by twojcik 34
  • Router.render() disappeared in 7, where did it go?

    Router.render() disappeared in 7, where did it go?

    In Restify 6 one could pull up a named templated URI and replace the params with values to construct a URI. This was great for hypermedia APIs that create links to other resources.

    This code was deleted in 7 (see https://github.com/restify/node-restify/commit/82832771826321480e5e524db258668f62b689c2) and I've looked everywhere for it's replacement.

    Hints?

    opened by mattbishop 28
  • Migrating to beta - CORS middleware

    Migrating to beta - CORS middleware

    I recently migrated to restify beta, and following that restify.CORS is no longer available. I tried to use the restify-cors-middleware module but it doesn't work, when I looked closely at the npm list of installed modules I noticed it's not even supposed to work for restify beta? (beta is version 5 and above)

    npm ERR! peer dep missing: [email protected] - 4.3.x, required by [email protected]

    If that is the case, is there another way for me to use CORS in the beta?

    Bug Open PR 
    opened by royibernthal 26
  • Error handling documentation is incomplete.

    Error handling documentation is incomplete.

    Edit / resolution

    The documentation about error handling is incomplete and confusing. Maybe it would help to explicitly clarify the following points in the section on error handling:

    1. Handle your errors immediately, where they're generated. next(err) really means res.send(err). It's not an alternative to throw err. If you need to log and shut down, pass it off to an error handling module instead of stuffing it in next(err) where it will be swallowed.
    2. server.on('uncaughtException'... is how you handle any errors that were thrown in middleware / routes. It works fine for that purpose, as long as you remember the first guideline. 'uncaughtException' will not be triggered for next(err) calls.
    3. formatters are the way to customize error messages going out to the users. I don't think they should be used for the other tasks described in this thread. They're definitely not a viable alternative to dealing with errors in uncaughtException, because presumably, once you get there, you're sending the user the error you want them to see... not necessarily the error that was originally generated. See point 1.
    4. For errors unrelated to middleware, remember to use process.on('uncaughtException'...

    Here's the original issue, for posterity:

    Problem

    Restify swallows all errors coming from route handlers. It does invoke its own error handler, but that handler never bails, regardless of whether or not an error is recoverable.

    Expected

    It should be up to the application developer to determine whether or not a service restart is needed. While it should be safe to swallow 4xx errors, other types of unhandled errors could leave the application in undefined state, which could lead to all sorts of trouble.

    Reproduce

    Restify v2.6.0 Node v0.10.20

    var restify = require('restify'),
      app = restify.createServer(),
      errorHandler = require('../error-handler.js'),
    
      handleError = function handleError(err) {
        console.log('Caught error!'); // never happens
        setTimeout(function () {
          process.exit(1);
        }, 3000);
      },
    
      middlewareError =
          function middlewareError(req, res, next) {
        throw new Error('Random middleware error.');
      };
    
    
    app.get('/err', function (req, res, next) {
      // This doesn't get caught.
      next( new Error('Random unrecoverable error. ' +
        'Server is now running in undefined state!') );
    });
    
    app.get('/throwerr', function (req, res, next) {
      // This doesn't get caught.
      throw new Error('Random unrecoverable error. ' +
        'Server is now running in undefined state!');
    });
    
    // This gets caught, yay!
    app.use(middlewareError);
    
    app.get('/middleware', function (req, res, next) {
      // Placeholder to invoke middlewareError.
    });
    
    // This works for middleware. Fails for routes.
    app.on('uncaughtException', handleError);
    
    // Nope. This doesn't help.
    process.on('uncaughtException', handleError);
    
    app.listen(3000, function () {
      console.log('Listening on port 3000');
    });
    
    opened by ericelliott 26
  • Restify not working with nodejs v4.0.0 in mac os x

    Restify not working with nodejs v4.0.0 in mac os x

    Hello,

    i was trying my application that is using restify with nodejs v4.0.0, and it is not working. Once the require to restify is made the process just dies without giving any exception or error.

    Thank you, Joao Franco

    Dependencies Help Wanted Stale 
    opened by joaosousafranco 23
  • Async/await basic support

    Async/await basic support

    Discussion: async/await basic API

    What?

    Add support to async functions as middleware (.pre() and .use()) and route handlers. Keeps the first hook synchronous.

    Example

    const restify = require('restify');
    
    const server = restify.createServer({});
    
    server.use(async (req, res) => {
      req.something = await doSomethingAsync();
    });
    
    server.get('/params', async (req, res) => {
      const value = await asyncOperation(req.something);
       res.send(value);
    });
    

    Middleware API

    Restify implementation uses Chains for both .pre() and .use() middleware, which allows a consistent experience. All middleware right now must call next() or next(err). The proposed interface for the middleware function is:

    • fn.length === 2 (arity 2);
    • fn instanceof AsyncFunction;
    • If the async function resolves, it calls next();
    • the value resolved will be discarded;
    • if it rejects we call next(err) [error handling discussed in a section below];

    Route handler API

    Restify also uses Chains for both route handlers, which allows being very consistent. Right now, Restify treats route handlers just like middleware and forces the user to call next().

    • fn.length === 2 (arity 2);
    • fn instanceof AsyncFunction;
    • If the async function resolves, it calls next();
    • the value resolved will be discarded;
    • user must call res.send to send the body;
    • if it rejects we call next(err) [error handling discussed in a section below];

    However, we also have the opportunity, if we want to, to improve DevEx and allow the value resolved of the promise to be sent as the body. It causes some challenges in Fastify, but there are mitigations we can apply.

    For instance, we can check, inside the resolve handler for the async function, if the response has been flushed and if not we flush the response with whatever value the user returns. This approach has the drawback that if the user uses both, whatever he returns from the promise will be discarded.

    Besides that, there is the question of what should happen if the user calls:

    server.get('/params', async (req, res) => {
      setImmediate(() => {
          res.send(value);
      });
    });
    

    Should we wait for res.send and risk it never be called? Or should immediately call next() on resolution and let the timers being slightly off?

    I propose we deal with this particular use case with documentation and user education.

    If you have a callback context you should use a callback and if you have a promise or async/await context you should use the async handler.

    Alternatively, we could add a new API to Response .sent which is a getter for a promise that resolves when the response is sent. This allows us to use a similar approach to Fastify:

    server.get('/params', async (req, res) => {
      setImmediate(() => {
          res.send(value);
      });
      await res.sent;
    });
    

    Error handling

    As of right now, Restify allows users to throw non-errors and wraps it around an InternalError after emitting the error events.

    I propose that we keep the same behavior for the async handler, going through the same code path. The only exception is when the user returns the async function with a rejected promise without any value. For example:

    server.get('/params', async (req, res) => {
      return Promise.reject();
    });
    

    We can't prevent users from doing that. That is a valid Javascript code, even though it is not very useful. What we can do it if the rejection value is falsy we can create an AsyncHandlerRejection VError, which will allow the user a better debugging experience.

    PR

    #1833

    opened by ghermeto 22
  • memory leak

    memory leak

    I am pretty sure I found a major memory leak. It seems to be related to the gzipResponse and bodyParser plugins. I use node-memwatch to inspect the memory usage and force a garbage collection.

    Version Info

    ubuntu: 12.04
    node: 0.10.4
    restify: 2.6.0
    

    Server

    var fs = require('fs');
    var memwatch = require('memwatch');
    var restify = require('restify');
    
    var hd = null;
    
    function startDiff(req, res, next) {
        memwatch.gc();
        hd = new memwatch.HeapDiff();
        return next();
    }
    
    function endDiff(req, res, next) {
        memwatch.gc();
        var diff = hd.end();
    
        console.log('before: ' + diff.before.size);
        console.log('after: ' + diff.after.size);
        console.log('change: ' + diff.change.size);
        console.log('---------------------');
    
        return next();
    }
    
    var server = restify.createServer();
    
    // removing either plugin also exhibits the memory leak
    // remove both plugins and no memory leak
    server.use(restify.gzipResponse());
    server.use(restify.bodyParser());
    
    server.get('/', [
        startDiff,
        function(req, res, next) {
            // large-file.json is a just a large JSON file, content does not matter
            var data = fs.readFileSync('large-file.json'));
            res.send(JSON.parse(data));
            return next();
        },
        endDiff,
    ]);
    
    server.listen(4001, function() {
        console.log('listening at ' + server.url);
    });
    

    Client

    curl --compressed http://localhost:4001 > /dev/null
    

    Output after 3 client calls, with memory leak

    before: 5.99 mb
    after: 175.48 mb
    change: 169.5 mb
    ---------------------
    before: 175.83 mb
    after: 318.21 mb
    change: 142.38 mb
    ---------------------
    before: 318.4 mb
    after: 460.75 mb
    change: 142.35 mb
    ---------------------
    

    Output after 3 client calls, with no memory leak

    before: 5.87 mb
    after: 147.82 mb
    change: 141.94 mb
    ---------------------
    before: 5.36 mb
    after: 147.86 mb
    change: 142.5 mb
    ---------------------
    before: 5.4 mb
    after: 147.88 mb
    change: 142.48 mb
    ---------------------
    
    Bug 
    opened by rpedela 22
  • OPTIONS does not work with CORS by default

    OPTIONS does not work with CORS by default

    I received the error message:

    405 (Method Not Allowed)
    

    when making an OPTIONS request. Backbone does this by default.

    There seems to be lots of discussion about it in issue #284, but I didn't find a solution that worked with node-restify 2.8.2.

    The code I am using is:

    server.pre(restify.CORS());
    server.use(restify.fullResponse());
    

    What is the current recommended solution?

    Bug Open PR 
    opened by andyuk 20
  • Restify doesn't provide a way to catch Promise rejections in a middleware

    Restify doesn't provide a way to catch Promise rejections in a middleware

    I want to be able to have a function that is called unhandled Promise rejections that happen inside a Restify middleware, to send the error to user. There is server.on('uncaughtException', ...) that catches all the errors, but if my middleware is async function or it returns a Promise, this handler won't catch it.

    Example:

    // server creation is omitted
    
    server.on('uncaughtException', (req, res, route, err) => {
     console.log(err);
      res.send({ success: false, error: err.message });
    });
    
    server.get('/', async (res, req, next) => {
      throw new Error('Some error');
    })
    

    If I run this example, it won't call the error handler and will print this instead:

    (node:23037) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Some error
    

    Restify 4.3.0, tested with Node.js 6.10.0 (compiled with Babel) and 7.9.0 (it supports async natively)

    Feature 
    opened by serge1peshcoff 19
  • custom contentWriters (again!)

    custom contentWriters (again!)

    Hey,

    I have been stupid at some point - either now or when I suggested pull request #33. I have been playing around with my custom content writer and the only way I seem to be able to call it within the scope of the response object (for access to _code etc) is to explictly do (at around line 85 of http_extra.js):

    else if (this._config.contentWriters[this._accept]) {
          var fn = this._config.contentWriters[this._accept];
          data = fn.call(this, _opts.body); //use .call() to force the scope
        }
    

    Other than doing this, I seem to be having no luck due to all the references and mayhem with scopes that are going on elsewhere.

    If you agree that this is the way to go then I will ping you a pull request (and even make sure its got semi-colons where needed!)

    Cheers, Ben

    opened by benhowes 19
  • fix: destroyed async/await handler

    fix: destroyed async/await handler

    Pre-Submission Checklist

    • [x] Opened an issue discussing these changes before opening the PR
    • [x] Ran the linter and tests via make prepush
    • [x] Included comprehensive and convincing tests for changes

    Issues

    Closes:

    • Issue #1935

    Changes

    Fix unstopped chain-handler when response already destroyed.

    opened by Misyuari 0
  • New async/await handler support breaks `next(false)` functionality in current async handlers

    New async/await handler support breaks `next(false)` functionality in current async handlers

    • [x] Used appropriate template for the issue type
    • [x] Searched both open and closed issues for duplicates of this issue
    • [x] Title adequately and concisely reflects the feature or the bug

    Restify Version: 10.0.0 Node.js Version: 16.8.1

    Expected behaviour

    Given a handler that does async work, I should be able to call next(false); and have the chain stop processing there.

    Actual behaviour

    The handler arity checks prevent me from having handlers that use next and are async

    Repro case

    Code similar to this is used in one of our projects using restify v8. It breaks when trying to update to v10:

    server.use(async (req, res, next) => {
      const result = await someAsyncWork();
      if (shouldStop(result)) {
        res.send({something: 'here'});
        next(false);
        return;
      }
    
      // ... more work
      next();
    });
    

    I am aware I could make my handler synchronous, then do someAsyncWork().then(result => {...}) but async/await syntax was chosen for cleanliness and readability.

    Cause

    https://github.com/restify/node-restify/blob/2053ef6a7e16d380a4e33d40059ea987c7373e4c/lib/chain.js#L77-L101

    Are you willing and able to fix this?

    This probably requires reworking the async chain stuff, so no.

    opened by gmahomarf 0
  • Upgrade formidable dependency to resolve npm warning

    Upgrade formidable dependency to resolve npm warning

    • [x ] Used appropriate template for the issue type
    • [x ] Searched both open and closed issues for duplicates of this issue
    • [x ] Title adequately and concisely reflects the feature or the bug

    Restify Version: 10.0.0 Node.js Version: v18.12.1

    Expected behaviour

    Should be able to install restify as a dependency without generating npm warnings about deprecated formidable dependency.

    Actual behaviour

    npm install emits: npm WARN deprecated [email protected]: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau

    Repro case

    Add restify as a dependency to your package.json and run npm install.

    Cause

    Need to upgrade formidable dependency to latest v2 or v3.

    Are you willing and able to fix this?

    Yes

    opened by sternam 1
  • package.json's =10.0.0"` but actual base version is v14.18.0">

    package.json's "engines" says `"node": ">=10.0.0"` but actual base version is v14.18.0

    • [x] Used appropriate template for the issue type
    • [x] Searched both open and closed issues for duplicates of this issue
    • [x] Title adequately and concisely reflects the feature or the bug

    Restify Version: 9.0.0 Node.js Version: any

    Expected behaviour

    That the "engines" field of "package.json" accurately says what versions of node.js restify works with.

    Actual behaviour

    The "engines" for [email protected], and in the current repo tip, says "node": ">=10.0.0". However, with anything less that node v14.8.0 importing restify crashes:

    % node --version
    v14.17.6
    
    % git remote -v
    origin	[email protected]:restify/node-restify.git (fetch)
    origin	[email protected]:restify/node-restify.git (push)
    % git log --oneline -1
    426f7e9 (HEAD -> master, origin/master, origin/HEAD) Update example to allow downgrading to http1
    
    % node -e 'require("./")'
    internal/modules/cjs/loader.js:892
      throw err;
      ^
    
    Error: Cannot find module 'node:process'
    Require stack:
    - /Users/trentm/src/node-restify/lib/request.js
    - /Users/trentm/src/node-restify/lib/server.js
    - /Users/trentm/src/node-restify/lib/index.js
    - /Users/trentm/src/node-restify/[eval]
        at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
        at Function.Module._load (internal/modules/cjs/loader.js:745:27)
        at Module.require (internal/modules/cjs/loader.js:961:19)
        at require (internal/modules/cjs/helpers.js:92:18)
        at Object.<anonymous> (/Users/trentm/src/node-restify/lib/request.js:5:25)
        at Module._compile (internal/modules/cjs/loader.js:1072:14)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
        at Module.load (internal/modules/cjs/loader.js:937:32)
        at Function.Module._load (internal/modules/cjs/loader.js:778:12)
        at Module.require (internal/modules/cjs/loader.js:961:19) {
      code: 'MODULE_NOT_FOUND',
      requireStack: [
        '/Users/trentm/src/node-restify/lib/request.js',
        '/Users/trentm/src/node-restify/lib/server.js',
        '/Users/trentm/src/node-restify/lib/index.js',
        '/Users/trentm/src/node-restify/[eval]'
      ]
    }
    

    Repro case

    (Shown above.)

    Cause

    The issue is the usage of "Core modules" (i.e. the node:-prefix) in "lib/request.js":

    const { emitWarning } = require('node:process');
    

    Are you willing and able to fix this?

    Yes. A few questions, though:

    • IIUC, The intent of commit c15111fb2862705d49dbd6cf60612069f13adb8d was to drop node v10 and v12 support, so would a PR to update "engines" be acceptable?

    • Support for all of node v14 (back to v14.0.0) could be restored with the following change.

    diff --git a/lib/request.js b/lib/request.js
    index a4c54d0..d67dc96 100644
    --- a/lib/request.js
    +++ b/lib/request.js
    @@ -2,7 +2,7 @@
    
     'use strict';
    
    -const { emitWarning } = require('node:process');
    +const { emitWarning } = require('process');
    

    or even just this change:

    -const { emitWarning } = require('node:process');
    +const { emitWarning } = process;
    

    Is that desired? I don't have a strong preference.

    • It seems that the "9.x" branch is out of sync. Should I make my PR against the "master" branch, and ignore "9.x"?

    PR https://github.com/restify/node-restify/pull/1923 is somewhat related to this. Thanks.

    opened by trentm 2
  • CVE-2022-37624/ Prototype pollution in jsonBodyParser.js

    CVE-2022-37624/ Prototype pollution in jsonBodyParser.js

    Prototype pollution vulnerability in function jsonBodyParser in jsonBodyParser.js in restify node-restify 9.0.0-rc.1 via the k variable in jsonBodyParser.js.

    The prototype pollution vulnerability can be mitigated with several best practices described here: [https://learn.snyk.io/lessons/prototype-pollution/javascript/]

    opened by Supraja9726 0
Releases(v10.0.0)
  • v10.0.0(Nov 29, 2022)

  • v9.0.0(Nov 15, 2022)

    9.0.0 (2022-11-15)

    ⚠ BREAKING CHANGES

    • remove deprecated usage of pino.child (#1902)
    • deprecates and removes re-routing when passing a string parameter to next()
    • removes RequestCaptureStream and replaces Bunyan with Pino
    • adds async/await support to pre, use and handler chains
    • drops suppoprt to node 8 and updates linting rules
    • server: - Server returns RequestCloseError instead of RequestAbortedError
    • travisci: dropping support below Node.js 4

    Features

    • async/await support (12be9e2)
    • deprecate req.closed (d052b7c)
    • provide callback to uncaughtException handler (#1766) (5e8b5e2)
    • remove re-routing from handler (#1847) (9153587)
    • send 500s for unhandled requests (#1777) (885cecd)
    • audit: Add the ability to specify a custom audit log serializer (for err, req and res) (#1746) (6231acd)
    • chain: schedule handlers to the next tick (#1798) (806ed71)
    • chain: use nextTick instead of setImmediate (#1808) (703470a)
    • deps: replace cover/istanbul with nyc (#1823) (361f83e)
    • first: Handlers that execute ASAP in the req/res lifecycle (#1756) (8178098)
    • http2: add native HTTP/2 support (#1489) (6b20285)
    • plugin: plugin to serve static files (#1753) (a67b25f)
    • Ability to find a route by a path (711a489)
    • add router.render() back to support hypermedia usecase (#1752) (0700cfd), closes #1684
    • helpers: add compose feature (#1660) (eb60ef4)
    • plugins: context, req.get() returns the whole context (#1739) (6e35e01)
    • plugins: do not include user-input in UnsupportedMediaTypeError message (VError fails), move it to info (#1733) (06c220d)
    • req: add restifyDone event (#1740) (4900d6b)
    • add support for non-strict formatters (#1721) (de1833a)
    • jsonBodyParser handles extended content types *+json (#1663) (4537514)
    • router: add ignoreTrailingSlash router option (#1632) (92ffbf5)
    • server: new router and middleware system (#1561) (8283277)
    • cpuUsageThrottle (#1460) (84be679)
    • throttle plugin: expose rate limit metrics as headers (#1453) (1627a55)
    • create inflightRequestThrottle plugin (#1431) (285faf4)
    • revert async formatters (#1377) (a2e300f)

    Bug Fixes

    • add support for secureOptions in createServer (#1575) (656e60e)

    • Allow multiple unmerged set-cookie headers. (#1570) (df04015)

    • Correct typo in assertion message (#1904) (195cf13)

    • documentation typo fix (#1688) (0fa7132)

    • don't create empty clientError listener for http.Server (#1895) (ddc1042)

    • emit after event with proper error param for node versions >= 11.4.0 (#1732) (7a1378b)

    • examples/todoapp/package.json to reduce vulnerabilities (#1832) (d9b27c6)

    • format falsy constants properly in json formatter (#1792) (3002182)

    • make arity error message actionable (#1901) (97b6f93)

    • more flaky metrics.test.js fixes (#1730) (71aac42)

    • properly handle non-errors thrown in domains (#1757) (cb2e717)

    • proxy events into instance var and add test script (#1661) (de72f49)

    • Re-add support for clientError listeners (#1897) (05f12a6)

    • remove invalid triggering of uncaughtException handler (#1710) (ee69806)

    • Return 444 status code for closed and aborted requests (#1579) (644c198)

    • send numbers or bools as payloads (#1609) (0919f26)

    • server should fire not acceptable event (#1627) (8b11b71)

    • use close event on response instead of socket (#1892) (5c7eb95)

    • use more reliable close event (36318ae)

    • benchmark: force latest restify version (#1810) (b8ec60e)

    • bodyReader: Fix memory leak (#1566) (756b3f0)

    • cpuUsageThrottle: Always queue a new timeout (#1484) (e4ffe43)

    • cpuUsageThrottle: Correctly named handler for debugInfo (#1499) (78b0900)

    • cpuUsageThrottle: dont include interval in lag (#1504) (eecb2d2)

    • cpuUsageThrottle: support breaking change in pidusage module (7460064)

    • dev: pin to exact versions of linting tools and fix lint errors (3740a6b)

    • dev: remove nsp since the project merged with npm (1dc34b4)

    • dev: upgrading modules including restify-errors (#1755) (3b71229)

    • dtrace: route probes (#1659) (84bcded)

    • inflightRequestThrottle: properly handle next (#1471) (4db404f)

    • jsonBodyParser: fix percent sign causing server fail (#1411) (bde8fda)

    • npm: exclude extraneous files (#1818) (e8516c3)

    • npm: remove unleash dependency (#1522) (a43aa60)

    • package-lock.json: remove artifacts.netflix.com repo (#1526) (3d2f0f7)

    • plugins: save req._matchedVersion (#1642) (69f917a)

    • plugins: use process.hrtime() for duration calculation (#1507) (e8efd6c)

    • request: date() and time() methods return value (#1576) (4c2cb1a)

    • server: address domain performance regression with Node v12.x (#1809) (e648d49)

    • server: address req and res close event changes in Node v10.x (#1672) (6be3fb7)

    • server: avoid http2 experimental warning without http2 option (#1555) (12da7fd)

    • server: avoiding uncaughtException in _routeErrorResponse by only sending response when not sent (#1568) (cf65c65)

    • server: fix uncaught exceptions triggering route lookups (#1717) (e49cb3b)

    • test: make upgrade test pass (#1772) (d30b748)

    • 652 - Incorrect error on route with no versions (#1465) (ee15490)

    • Add migration guid to website (#1402) (5f053c7)

    • add node 7-8 travis support (#1405) (536a473)

    • create unit tests for sanitizePath plugin (#1352) (12714cf)

    • doc site (#1393) (76ee548)

    • documentation update for restifyError event example (#1398) (94fe715)

    • emit restifyError event even for router errors (#1420) (f9d02d5)

    • redirect should work even when hostname or protocol is not specified in req.url (#1497) (e696a1f)

    • server: error in pre handler triggers after event (#1500) (c2e6dea)

    • exclude package-lock.json (#1477) (011fdf0)

    • static: avoid user-provided data in Error messages being interpreted as sprintf codes (#1384) (#1472) (9906344)

    • audit timers of same name should accumulate (#1435) (#1443) (a2d34aa)

    • GH-1438, error reponse customization documentation incorrect (#1439) (dd66088)

    • Honor port for redirect (#1363) (61c0cb5)

    • monkey patch getHeaders for pre-v7 Node.js (GH-1409) (82088a7)

    • package.json version now matches npm (9944dbd)

    • respect when status code is set with res.status (GH-1429) (#1440) (5abc067)

    • test static plugin's handling of sprintf escape sequences (#1391) (5d7039a)

    • update chai (^3.4.1 to ^4.0.0) (f982d0c)

    • Update dependency mime to 1.4.0 (#1467) (6d38b38)

    • update http-signature to v1.0.0 (#1401) (ec88737)

    • use Buffer.isBuffer instead of util.isBuffer. (#1593) (35bd1c2)

    • versioned route matching should not throw TypeError (#1381) (25d10f0)

    • audit: use public APIs for accessing response headers (5169db7), closes /nodejs.org/api/deprecations.html#deprecations_dep0066

    • Prefer Pino logger over Bunyan (#1841) (2f5bf87), closes #1841

    Miscellaneous Chores

    • drop support for node 8 (bd34988)
    • remove deprecated usage of pino.child (#1902) (0a8cf83)
    • travisci: revisit nodejs version. Change to: LTS active, LTS maintenance (4.x) and stable releases (#1553) (49eb008)
    Source code(tar.gz)
    Source code(zip)
  • v8.6.1(Feb 10, 2022)

  • v8.6.0(Sep 29, 2021)

  • v8.5.1(Jul 10, 2020)

    Bug Fixes

    • benchmark: force latest restify version (#1810) (b8ec60e3)
    • server: address domain performance regression with Node v12.x (#1809) (e648d491)
    Source code(tar.gz)
    Source code(zip)
  • v4.0.3(Sep 18, 2015)

    This release is a quick fix for people that are getting a different error code when on Node 4 when the Content Length is too long for the Body Parser.

    You only need to upgrade if you are running iojs 3.0+ or Node 4+.

    Changelog: #917 Fix: HTTP 413 status name, Micah Ransdell

    Source code(tar.gz)
    Source code(zip)
  • v4.0.2(Sep 10, 2015)

    After a little bit of a hiccup with 4.0.1, we are back in the saddle with 4.0.2. This release adds proper Node 4 support by upgrading dtrace-provider to 0.6.

    #887 Bump dtrace-provider to 0.6.0 for Node 4 support, Corbin Uselton

    Thanks to our newest contributor, Corbin Uselton (@corbinu) for the help.

    Source code(tar.gz)
    Source code(zip)
  • v4.0.0(Aug 18, 2015)

    There are lots of changes in Restify 4. See below for a list of pull requests that were merged in. There were quite a few bugs fixed, and a few new features added. Thanks to all our contributors for their hard work!

    #877 content-type can be case-insensitive. Yunong Xiao #856 update various dependencies. Alex Liu #851 fix formatters such that they always return cb. Yunong Xiao #847 fix body parser race condition. Yunong Xiao #842 add req.matchedVersion() Nathan Peck, Micah Ransdell #840 Fix issue with server toString Method. OiNutter, Micah Ransdell #836 Add JSDoc comments. Alex Liu #835 Update static.js to allow for serving static files that do not use the route as a path. Wavewash, Micah Ransdell #831 Support hash option to Formidable for multipart file uploads. blakevanian, ManRueda #832 Updated dtrace-provider. yads #812 add query parameters to auditlogger. Alex Liu #800 Allow 0, false, and null as json body. Alex Dobeck #771 q-value choice on wildcards ignores default q-value of 1. Kevin Peno #822 Allow optional headers to be added as properties to bunyan logs. Michael Paulson. #824 Don't include large coverage files in published packages. Trent Mick #819 Add a feature to allow the expiration of old unprocessed requests. Michael Paulson #803 Add redirect support to Response. Alex Liu #686 res.send can't send 0, false and null. Alex Dobeck

    Source code(tar.gz)
    Source code(zip)
  • 3.0.0(Mar 11, 2015)

Owner
restify
Observable RPC Framework for Node.js
restify
A framework for real-time applications and REST APIs with JavaScript and TypeScript

A framework for real-time applications and REST APIs with JavaScript and TypeScript Feathers is a lightweight web-framework for creating real-time app

Feathers 14.3k Jan 1, 2023
Fast, unopinionated, minimalist web framework for node.

Fast, unopinionated, minimalist web framework for node. const express = require('express') const app = express() app.get('/', function (req, res) {

null 59.5k Jan 5, 2023
A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications on top of TypeScript & JavaScript (ES6, ES7, ES8) 🚀

A progressive Node.js framework for building efficient and scalable server-side applications. Description Nest is a framework for building efficient,

nestjs 53.2k Dec 31, 2022
Expressive middleware for node.js using ES2017 async functions

Expressive HTTP middleware framework for node.js to make web applications and APIs more enjoyable to write. Koa's middleware stack flows in a stack-li

Koa.js 33.5k Jan 4, 2023
Realtime MVC Framework for Node.js

Website Get Started Docs News Submit Issue Sails.js is a web framework that makes it easy to build custom, enterprise-grade Node.js apps. It is design

Balderdash 22.4k Dec 31, 2022
🥚 Born to build better enterprise frameworks and apps with Node.js & Koa

Features Built-in Process Management Plugin System Framework Customization Lots of plugins Quickstart Follow the commands listed below. $ mkdir showca

egg 18.3k Dec 29, 2022
Fast and low overhead web framework, for Node.js

An efficient server implies a lower cost of the infrastructure, a better responsiveness under load and happy users. How can you efficiently handle the

Fastify 26k Jan 2, 2023
📦🔐A lightweight private proxy registry build in Node.js

Version 6 (Development branch) Looking for Verdaccio 5? Check branch 5.x. Verdaccio is a simple, zero-config-required local private npm registry. No n

Verdaccio 14.3k Dec 31, 2022
🚀 The Node.js Framework highly focused on developer ergonomics, stability and confidence

Sponsored by FOSS United is a non-profit foundation that aims at promoting and strengthening the Free and Open Source Software (FOSS) ecosystem in Ind

AdonisJS Framework 13.4k Dec 31, 2022
Use full ES2015+ features to develop Node.js applications, Support TypeScript.

ThinkJS Use full ES2015+ features to develop Node.js applications, Support TypeScript. 简体中文文档 Installation npm install -g think-cli Create Application

ThinkJS 5.3k Dec 30, 2022
:rocket: Progressive microservices framework for Node.js

Moleculer Moleculer is a fast, modern and powerful microservices framework for Node.js. It helps you to build efficient, reliable & scalable services.

MoleculerJS 5.5k Jan 4, 2023
MVC framework making it easy to write realtime, collaborative applications that run in both Node.js and browsers

Derby The Derby MVC framework makes it easy to write realtime, collaborative applications that run in both Node.js and browsers. Derby includes a powe

DerbyJS 4.7k Dec 23, 2022
Node.js framework

Node.js framework Total.js framework is a framework for Node.js platfrom written in pure JavaScript similar to PHP's Laravel or Python's Django or ASP

Total.js 4.2k Jan 2, 2023
API Services Made Easy With Node.js

Nodal API Services Made Easy with Node.js View the website at nodaljs.com. Nodal is a web server and opinionated framework for building data manipulat

Keith Horwood 4.5k Dec 26, 2022
A microservices toolkit for Node.js.

A Node.js toolkit for Microservice architectures This open source module is sponsored and supported by Voxgig. seneca Lead Maintainer: Richard Rodger

Seneca Microservices Framework 3.9k Dec 19, 2022
🍔 A Node.js Serverless Framework for front-end/full-stack developers. Build the application for next decade. Works on AWS, Alibaba Cloud, Tencent Cloud and traditional VM/Container. Super easy integrate with React and Vue. 🌈

Midway - 一个面向未来的云端一体 Node.js 框架 English | 简体中文 ?? 欢迎观看 Midway Serverless 2.0 发布会回放: https://www.bilibili.com/video/BV17A411T7Md 《Midway Serverless 发布

Midway.js 6.3k Jan 8, 2023
:evergreen_tree: Modern Web Application Framework for Node.js.

Trails is a modern, community-driven web application framework for Node.js. It builds on the pedigree of Rails and Grails to accelerate development by

Trails 1.7k Dec 19, 2022
Marble.js - functional reactive Node.js framework for building server-side applications, based on TypeScript and RxJS.

Functional reactive Node.js framework for building server-side applications, based on TypeScript and RxJS. Ecosystem Name Description @marblejs/core F

Marble.js 2.1k Dec 16, 2022
🔬 Writing reliable & fault-tolerant microservices in Node.js

A Node.js microservices toolkit for the NATS messaging system Run on repl.it Node: v6+ Documentation: https://hemerajs.github.io/hemera/ Lead Maintain

HemeraJs 800 Dec 14, 2022