JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 32448
  • Score
    100M100P100Q136222F

Routing for static site generators and build systems, heavily based on express.js and kerouac routes.

Package Exports

  • en-route

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (en-route) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

en-route NPM version

Routing for static site generators and build systems, heavily based on express.js and kerouac routes.

Install

Install with npm

npm i en-route --save

API

Router

Router

Initialize a new Router with the given options.

  • options {Object}
var Router = require('en-route');
var router = new Router(options);

.middleware

  • file {Object}: File object.
  • next {Function}: Callback.
  • returns: {Object}

Call the dispatcher on a file object.

.middlewareSync

  • file {Object}: File object.
  • returns {Object}: object containing an err if an error occurred.

Call the dispatcher on a file object.

.route

  • filepath {String}
  • middleware {Function|Array}: Middleware stack.
  • returns: {Object}

Route filepath to one or more callbacks.

.use

Utilize the given middleware fn to the given path, defaulting to _/_.

  • path {String|Function}
  • fn {Function}
  • returns {Router}: for chaining.

Example:

router.use();

Author

Jon Schlinkert

Brian Woodward

License

Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license

Based on previous work by:

Copyright (c) 2009-2014 TJ Holowaychuk tj@vision-media.ca Copyright (c) 2012-2013 Jared Hanson http://jaredhanson.net/


This file was generated by verb-cli on October 12, 2014.