neuron-dev-server

2.3.0 • Public • Published

Build Status

neuron-dev-server

neuron-dev-server is a static file server and reverse proxy.

Install

$ npm install neuron-dev-server --save

Usage

For example, in conjunction with Express

var middleware = require('neuron-dev-server');
 
var options = {
  routers: [
    {
      // defines it as default
      default: true,
 
      // If the `req.url` matches `location`
      location: '/mod',
 
      // Then we will search the static file from
      root: '/path/to/mod',
      
      // If not found, then bypass to:
      by_pass: 'http://domain.com/mod'
 
      // If by_pass not specified, then `next()` will be called
    },
 
    {
      location: '/static',
      root: '/path/to/static'
    },
 
    ...
  ],
 
  // All requests will be fallback to:
  by_pass: 'http://domain.com'
};
 
 
var app = require('express')();
 
app
  // Use neuron-dev-server middleware for express
  .use(middleware(options))
  .listen(8000);

middleware.options(options)

Static method to clean the options.

License

MIT

Package Sidebar

Install

npm i neuron-dev-server

Weekly Downloads

11

Version

2.3.0

License

MIT

Last publish

Collaborators

  • kael