{"_id":"base-routes","_rev":"231897","name":"base-routes","description":"Plugin for adding routes support to your `base` application. Requires templates support to work.","dist-tags":{"latest":"1.0.1"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"time":{"modified":"2021-06-03T15:46:45.000Z","created":"2015-11-29T13:03:41.906Z","1.0.1":"2017-08-07T08:39:26.599Z","1.0.0":"2017-08-07T07:30:17.740Z","0.2.2":"2016-07-09T04:21:15.394Z","0.2.1":"2016-06-07T07:22:00.307Z","0.2.0":"2016-05-17T12:06:23.602Z","0.1.0":"2015-11-29T13:03:41.906Z"},"users":{},"author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/node-base/base-routes.git"},"versions":{"1.0.1":{"name":"base-routes","description":"Plugin for adding routes support to your `base` application. Requires templates support to work.","version":"1.0.1","homepage":"https://github.com/node-base/base-routes","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/node-base/base-routes.git"},"bugs":{"url":"https://github.com/node-base/base-routes/issues"},"license":"MIT","files":["index.js","utils.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"debug":"^2.6.8","en-route":"^1.0.1","is-valid-app":"^0.3.0","template-error":"^0.1.2"},"devDependencies":{"base-app":"^0.2.6","gulp-format-md":"^1.0.0","mocha":"^3.5.0","should":"^11.2.1"},"keywords":["api","app","application","base","base-plugin","baseplugin","building-blocks","create","framework","middleware","plugin","plugins","router","routes","routing","tool","toolkit","tools"],"verb":{"related":{"list":["base","en-route","gulp-routes"]},"toc":true,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"lint":{"reflinks":true},"reflinks":["verb","base"]},"gitHead":"04762853f69cd00a354b9b230bd8acfc9f6e09f3","_id":"base-routes@1.0.1","_npmVersion":"5.3.0","_nodeVersion":"7.7.3","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"7fd4372d25052f8922ba4ded7e1c764c5fcddaae","size":5498,"noattachment":false,"key":"/base-routes/-/base-routes-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/base-routes/download/base-routes-1.0.1.tgz"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/base-routes-1.0.1.tgz_1502095165672_0.49444143171422184"},"directories":{},"publish_time":1502095166599,"_hasShrinkwrap":false,"_cnpm_publish_time":1502095166599},"1.0.0":{"name":"base-routes","description":"Plugin for adding routes support to your `base` application. Requires templates support to work.","version":"1.0.0","homepage":"https://github.com/node-base/base-routes","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/node-base/base-routes.git"},"bugs":{"url":"https://github.com/node-base/base-routes/issues"},"license":"MIT","files":["index.js","utils.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"debug":"^2.6.8","en-route":"^1.0.0","is-valid-app":"^0.3.0","template-error":"^0.1.2"},"devDependencies":{"base-app":"^0.2.6","gulp-format-md":"^1.0.0","mocha":"^3.5.0","should":"^11.2.1"},"keywords":["api","app","application","base","base-plugin","baseplugin","building-blocks","create","framework","middleware","plugin","plugins","router","routes","routing","tool","toolkit","tools"],"verb":{"related":{"list":["base","en-route","gulp-routes"]},"toc":true,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"lint":{"reflinks":true},"reflinks":["verb","base"]},"gitHead":"e043b8d65ab080e596eadbaa330ca329d8561a8a","_id":"base-routes@1.0.0","_npmVersion":"5.3.0","_nodeVersion":"7.7.3","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"c90f32eaff437a700a0acdcfe7e58696d4139cc8","size":5453,"noattachment":false,"key":"/base-routes/-/base-routes-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/base-routes/download/base-routes-1.0.0.tgz"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/base-routes-1.0.0.tgz_1502091016711_0.9100842697080225"},"directories":{},"publish_time":1502091017740,"_cnpm_publish_time":1502091017740,"_hasShrinkwrap":false},"0.2.2":{"name":"base-routes","description":"Plugin for adding routes support to your `base` application. Requires templates support to work.","version":"0.2.2","homepage":"https://github.com/node-base/base-routes","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/node-base/base-routes.git"},"bugs":{"url":"https://github.com/node-base/base-routes/issues"},"license":"MIT","files":["index.js","LICENSE","README.md","utils.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"debug":"^2.2.0","en-route":"^0.7.5","is-valid-app":"^0.2.0","lazy-cache":"^2.0.1","template-error":"^0.1.2"},"devDependencies":{"base-app":"^0.2.2","gulp-format-md":"^0.1.9","mocha":"^2.4.5","should":"^8.3.1"},"keywords":["api","app","application","base","baseplugin","building-blocks","create","framework","middleware","plugin","plugins","router","routes","routing","tool","toolkit","tools"],"verb":{"related":{"list":["base","base-option","base-plugins","en-route","templates"]},"toc":true,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"lint":{"reflinks":true},"reflinks":["verb"]},"gitHead":"0ebf13c0c0a42dfcd5f007dacc0e45cadb6fddfb","_id":"base-routes@0.2.2","_shasum":"0a614d172d49045d8c9387713f860df3c405341e","_from":".","_npmVersion":"3.8.9","_nodeVersion":"6.2.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"0a614d172d49045d8c9387713f860df3c405341e","size":3956,"noattachment":false,"key":"/base-routes/-/base-routes-0.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/base-routes/download/base-routes-0.2.2.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/base-routes-0.2.2.tgz_1468038072900_0.1522416458465159"},"directories":{},"publish_time":1468038075394,"_cnpm_publish_time":1468038075394,"_hasShrinkwrap":false},"0.2.1":{"name":"base-routes","description":"Plugin for adding routes support to your `base` application. Requires templates support to work.","version":"0.2.1","homepage":"https://github.com/node-base/base-routes","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/node-base/base-routes.git"},"bugs":{"url":"https://github.com/node-base/base-routes/issues"},"license":"MIT","files":["index.js","utils.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"debug":"^2.2.0","en-route":"^0.7.5","is-valid-app":"^0.1.0","lazy-cache":"^2.0.1"},"devDependencies":{"base-app":"^0.2.2","gulp-format-md":"^0.1.9","mocha":"^2.4.5","should":"^8.3.1"},"keywords":["base","baseplugin","middleware","plugin","router","routes","routing"],"verb":{"related":{"list":["base","base-option","base-plugins","en-route","templates"]},"toc":true,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"lint":{"reflinks":true},"reflinks":["verb"]},"gitHead":"1f40b533dc5174965b40d816906cbb8593fc357f","_id":"base-routes@0.2.1","_shasum":"7ed2d49090244fc2ea442da35ad4cb84b372e9e6","_from":".","_npmVersion":"3.8.9","_nodeVersion":"6.2.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"7ed2d49090244fc2ea442da35ad4cb84b372e9e6","size":3789,"noattachment":false,"key":"/base-routes/-/base-routes-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/base-routes/download/base-routes-0.2.1.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/base-routes-0.2.1.tgz_1465284118505_0.4679286531172693"},"directories":{},"publish_time":1465284120307,"_cnpm_publish_time":1465284120307,"_hasShrinkwrap":false},"0.2.0":{"name":"base-routes","description":"Plugin for adding routes support to your `base` application. Requires templates support to work.","version":"0.2.0","homepage":"https://github.com/node-base/base-routes","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/node-base/base-routes.git"},"bugs":{"url":"https://github.com/node-base/base-routes/issues"},"license":"MIT","files":["index.js","utils.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"debug":"^2.2.0","en-route":"^0.7.5","is-registered":"^0.1.3","is-valid-instance":"^0.1.0","lazy-cache":"^2.0.1"},"devDependencies":{"base-app":"^0.2.2","gulp-format-md":"^0.1.9","mocha":"^2.4.5","should":"^8.3.1"},"keywords":["base","routes"],"verb":{"related":{"list":["base","base-option","base-plugins","en-route","templates"]},"toc":true,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"lint":{"reflinks":true},"reflinks":["verb"]},"gitHead":"438ca138c746984af3f99da35bf20c5e43830d57","_id":"base-routes@0.2.0","_shasum":"f6cfdacca48dcc4fbb527bcf953d997072b19e3e","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.5.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"f6cfdacca48dcc4fbb527bcf953d997072b19e3e","size":5186,"noattachment":false,"key":"/base-routes/-/base-routes-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/base-routes/download/base-routes-0.2.0.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/base-routes-0.2.0.tgz_1463486781237_0.02342327474616468"},"directories":{},"publish_time":1463486783602,"_cnpm_publish_time":1463486783602,"_hasShrinkwrap":false},"0.1.0":{"name":"base-routes","description":"Plugin for adding routes support to your `base` application. Requires templates support to work.","version":"0.1.0","homepage":"https://github.com/jonschlinkert/base-routes","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/base-routes.git"},"bugs":{"url":"https://github.com/jonschlinkert/base-routes/issues"},"license":"MIT","files":["index.js","utils.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"en-route":"^0.7.3","lazy-cache":"^0.2.4"},"devDependencies":{"assemble-core":"^0.3.0","engine-base":"^0.1.2","mocha":"*","should":"^7.1.1"},"verb":{"related":{"list":["en-route","base-methods","base-plugins","base-options","templates"]}},"gitHead":"0f9996ea83cb47dae517b2b70201b30e0c36541a","_id":"base-routes@0.1.0","_shasum":"8638e587947dd37c60502d125f8f53cef074c379","_from":".","_npmVersion":"3.3.6","_nodeVersion":"5.0.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"8638e587947dd37c60502d125f8f53cef074c379","size":4433,"noattachment":false,"key":"/base-routes/-/base-routes-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/base-routes/download/base-routes-0.1.0.tgz"},"directories":{},"publish_time":1448802221906,"_cnpm_publish_time":1448802221906,"_hasShrinkwrap":false}},"readme":"# base-routes [![NPM version](https://img.shields.io/npm/v/base-routes.svg?style=flat)](https://www.npmjs.com/package/base-routes) [![NPM monthly downloads](https://img.shields.io/npm/dm/base-routes.svg?style=flat)](https://npmjs.org/package/base-routes) [![NPM total downloads](https://img.shields.io/npm/dt/base-routes.svg?style=flat)](https://npmjs.org/package/base-routes) [![Linux Build Status](https://img.shields.io/travis/node-base/base-routes.svg?style=flat&label=Travis)](https://travis-ci.org/node-base/base-routes)\n\n> Plugin for adding routes support to your `base` application. Requires templates support to work.\n\n- [Install](#install)\n- [Usage](#usage)\n- [API](#api)\n- [About](#about)\n\n_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save base-routes\n```\n\n## Usage\n\nRegister the plugin with your [base](https://github.com/node-base/base) application.\n\n```js\nvar routes = require('base-routes');\nvar Base = require('base-app');\n\nvar app = new Base();\napp.use(routes());\n```\n\n## API\n\n### [.Router](index.js#L23)\n\nThe `Router` and `Route` classes are on the `app` instance, in case they need to be accessed directly.\n\n**Example**\n\n```js\nvar router = new app.Router();\nvar route = new app.Route();\n```\n\n### [.handle](index.js#L54)\n\nHandle middleware `method` for the given `file`.\n\n**Params**\n\n* `methodName` **{String}**: Name of the router method to handle.\n* `file` **{Object}**: View object\n* `next` **{Function}**: Callback function\n* `returns` **{undefined}**\n\n**Example**\n\n```js\napp.handle('methodName', file, next);\n```\n\n### [.handleOnce](index.js#L114)\n\nRun the given middleware handler only if the file has not already been handled by `method`.\n\n**Params**\n\n* `method` **{Object}**: The name of the handler method to call.\n* `file` **{Object}**\n* `returns` **{undefined}**\n\n**Example**\n\n```js\napp.handleOnce(method, file, callback);\n// example\napp.handleOnce('onLoad', file, callback);\n```\n\n### [.route](index.js#L200)\n\nCreate a new Route for the given path. Each route contains a separate middleware stack. See the [en-route](https://github.com/jonschlinkert/en-route) API documentation for details on adding handlers and middleware to routes.\n\n**Params**\n\n* `path` **{String}**\n* `returns` **{Object}**: Returns the instance for chaining.\n\n**Example**\n\n```js\napp.create('posts');\napp.route(/blog/)\n  .all(function(file, next) {\n    // do something with file\n    next();\n  });\n\napp.post('whatever', {path: 'blog/foo.bar', content: 'bar baz'});\n```\n\n### [.param](index.js#L228)\n\nAdd callback triggers to route parameters, where `name` is the name of the parameter and `fn` is the callback function.\n\n**Params**\n\n* `name` **{String}**\n* `fn` **{Function}**\n* `returns` **{Object}**: Returns the instance for chaining.\n\n**Example**\n\n```js\napp.param('title', function(view, next, title) {\n  //=> title === 'foo.js'\n  next();\n});\n\napp.onLoad('/blog/:title', function(view, next) {\n  //=> view.path === '/blog/foo.js'\n  next();\n});\n```\n\n### [.all](index.js#L252)\n\nSpecial route method that works just like the `router.METHOD()` methods, except that it matches all verbs.\n\n**Params**\n\n* `path` **{String}**\n* `callback` **{Function}**\n* `returns` **{Object}** `this`: for chaining\n\n**Example**\n\n```js\napp.all(/\\.hbs$/, function(view, next) {\n  // do stuff to view\n  next();\n});\n```\n\n### [.handler](index.js#L274)\n\nAdd a router handler method to the instance. Interchangeable with the [handlers](#handlers) method.\n\n**Params**\n\n* `method` **{String}**: Name of the handler method to define.\n* `returns` **{Object}**: Returns the instance for chaining\n\n**Example**\n\n```js\napp.handler('onFoo');\n// or\napp.handler(['onFoo', 'onBar']);\n```\n\n### [.handlers](index.js#L293)\n\nAdd one or more router handler methods to the instance.\n\n**Params**\n\n* `methods` **{Array|String}**: One or more method names to define.\n* `returns` **{Object}**: Returns the instance for chaining\n\n**Example**\n\n```js\napp.handlers(['onFoo', 'onBar', 'onBaz']);\n// or\napp.handlers('onFoo');\n```\n\n## About\n\n### Related projects\n\nYou might also be interested in these projects:\n\n* [base](https://www.npmjs.com/package/base): Framework for rapidly creating high quality node.js applications, using plugins like building blocks | [homepage](https://github.com/node-base/base \"Framework for rapidly creating high quality node.js applications, using plugins like building blocks\")\n* [en-route](https://www.npmjs.com/package/en-route): Routing for static site generators, build systems and task runners, heavily based on express.js routes… [more](https://github.com/jonschlinkert/en-route) | [homepage](https://github.com/jonschlinkert/en-route \"Routing for static site generators, build systems and task runners, heavily based on express.js routes but works with file objects. Used by Assemble, Verb, and Template.\")\n* [gulp-routes](https://www.npmjs.com/package/gulp-routes): Add middleware to run for specified routes in your gulp pipeline. | [homepage](https://github.com/assemble/gulp-routes \"Add middleware to run for specified routes in your gulp pipeline.\")\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Building docs\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme && verb\n```\n\n### Running tests\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install && npm test\n```\n\n### Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on August 07, 2017._","_attachments":{},"homepage":"https://github.com/node-base/base-routes","bugs":{"url":"https://github.com/node-base/base-routes/issues"},"license":"MIT"}