Skip to content

Highly configurable request re-routing middleware for Connect.

Notifications You must be signed in to change notification settings

gmurphey/connect-conductor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Conductor

Conductor is highly configurable routing middleware for Connect.

Build Status

Options

Some contrived examples:

{
  routes: {
    '/':                    '/path/to/route/to',      // static routing
    '/assets/css/*path':    '/dist/css/[path]',       // wildcard routes
    '/api/:version/*path':  '/api/v[version]/[path]', // named routes
    '/assets/js/*path':     '/dist/[site]/js/[path]', // `site` routekey usage
    '/sites/:site/*path':   '/[site]/[path]'          // the `site` placeholder in the request takes precedence over routekeys
  }

  // can be overridden for individual requests
  routekeys: {
    'site': function (request) {
      return 'mysite';
    }
  }
}

Using With Grunt

// gruntfile definitions

connect: {
  options: {
    middleware: function (connect, options) {
      return [
        require('connect-conductor').route(options),
        // other middleware
      ]
    },

    routes: {
      // define routes
    },

    routekeys: {
      // define route keys
    }
  }
}

About

Highly configurable request re-routing middleware for Connect.

Resources

Stars

Watchers

Forks

Packages

No packages published