You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

restify-utils

Package Overview
Dependencies
Maintainers
3
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

restify-utils

Convenient utils for handling dynamic routing and configuration with restify framework

latest
Source
npmnpm
Version
1.6.8
Version published
Maintainers
3
Created
Source

Restify Utils

Install

npm i restify-utils -S

Usage

Main function

const attach = require('restify-utils')(configuration, endpointsDir, middlewareDir)

returns Function:

  • Function(server, family, prefix = '/api') with extra properties:
  • endpoints
  • middleware

Populates configuration.models

Goes through endpoints, that are in format of the following:

exports.VERB = {
  path: '/path/relative/to/prefix/family',
  middleware: [ 'middlewareName' ],
  handlers: {
    '1.0.0': function handler(req, res, next) {

    },
    '1.1.0': function xxx(req, res, next) {

    }
  },
};

It will be attached to VERB ${prefix}/${family}/path/relative/to/prefix/family with 2 versions: 1.0.0 and 1.1.0

Endpoints, middleware, models

  • Models - instances of classes in the models folder:
  • User
  • Endpoints - endpoints from the endpointsDir
  • Middleware - middleware from the middlewareDir

FAQs

Package last updated on 10 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts