restify-mw

0.0.1 • Public • Published

restify-mw


A collection of customized middleware for node-restify

Documentation


restifymw.serveStatic( options )

  • options Object - hash of options.
    • directory String - Local path to the file directory to serve from
    • [default] String - default file to serve (i.e. index.html)
    • [file] String - Specific file to serve
    • [virtual] String - A virtual directory path. This allows you to serve the route http://host/virtual/dir from /directory/dir instead of the standard /directory/virtual/dir allowing folder locations to be more flexible

Example

var restifymw = require('restify-mw');

// restify initialization code...

// create a route for http://host/js/vendor/*
server.get(/\/js\/vendor\/?.*/, restifymw.serveStatic({
    directory: __dirname + '/bower_components',
    virtual: '/js/vendor'
}));

// files are all served out of /module_path/bower_components
// i.e. route http://host/js/vendor/angular/angular.min.js 
// serves file /module_path/bower_components/angular/angular.min.js

Tools

Created with Nodeclipse (Eclipse Marketplace, site)

Nodeclipse is free open-source project that grows with your contributions.

Package Sidebar

Install

npm i restify-mw

Weekly Downloads

1

Version

0.0.1

License

MIT

Last publish

Collaborators

  • vbranden