You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

restify-route-map

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

restify-route-map

Dynamically attach routes given a source directory

1.0.2
latest
Source
npmnpm
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

restify-route-map

Dynamically attach routes given a source directory.

Install

npm i restify-route-map -S

Usage

// Route File eq. user.js
// A function wrapper is required for each route file
module.exports = function (server) {

  server.get('/', (req, res) => {
    // Handle request
  });
  
  server.post('/', (req, res) => {
      // Handle request
  });

};
// File where app is initialize eq. app.js

// Import
const restifyRouteMap = require('restify-route-map');

const server = restify.createServer();

// Initialize restify plugins

const options = { 
  directory: 'controllers',
  pattern: '**/*.js'
}

restifyRouteMap(server, options);

Options

  • baseDir - base directory, default value caller directory
  • directory - source directory, default value routes
  • pattern - files to match, uses glob, default value **/*.js

License

MIT

Keywords

restify

FAQs

Package last updated on 21 Mar 2018

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