{"_id":"express-routescan","_rev":"28-a84bb65d1d32a5fdd5f37013c7793911","name":"express-routescan","description":"Automatic file scanner for Express JS router.","dist-tags":{"latest":"0.2.1"},"versions":{"0.1.0":{"name":"express-routescan","homepage":"http://github.com/anotheri/express-routescan","author":{"name":"Alexander Bykhov","url":"http://github.com/anotheri"},"repository":{"type":"git","url":"http://github.com/anotheri/express-routescan.git"},"description":"Automatic file scanner for Express JS router.","keywords":["express","expressjs","router","route","file","automatic","scanner"],"version":"0.1.0","main":"./index","dependencies":{},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"bugs":{"url":"https://github.com/anotheri/express-routescan/issues"},"_id":"express-routescan@0.1.0","dist":{"shasum":"ea650a88d95b89ef5085187e5d64a2ca54d2df50","tarball":"https://registry.npmjs.org/express-routescan/-/express-routescan-0.1.0.tgz","integrity":"sha512-iEdLcrdfwROTojJx3h0zNUjvemfnZ42uTNgMOH4LzyY3RPYwD7Oz1Q0bY0gAkHXiSuQVhUEvQKPDe00fQb301w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCKf6tPK44kfucu/DUTJEhbeKsTZjcuvecUp98SMqFHKwIhAI9JY0I57aA5ebbOkSWTYFM1oPcUA7Neiicx2UDYWIoA"}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"},"maintainers":[{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"}]},"0.1.1":{"name":"express-routescan","homepage":"http://github.com/anotheri/express-routescan","author":{"name":"Alexander Bykhov","url":"http://github.com/anotheri"},"repository":{"type":"git","url":"http://github.com/anotheri/express-routescan.git"},"description":"Automatic file scanner for Express JS router.","keywords":["express","expressjs","router","route","file","automatic","scanner"],"version":"0.1.1","main":"./index","dependencies":{},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"bugs":{"url":"https://github.com/anotheri/express-routescan/issues"},"_id":"express-routescan@0.1.1","dist":{"shasum":"6c543395b53517e80bca8628517c34f73a607959","tarball":"https://registry.npmjs.org/express-routescan/-/express-routescan-0.1.1.tgz","integrity":"sha512-DMG8rS8Vmjl5m/Qa/YofA6+gogJT4xCPFcFuzyaCtpuAYMbUbmPXFk+XqA8ewtbsEjs9mxy26sqs9QfqXJPgcg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCPA51IAcTqGzTyKK1ZkU+v17vuLoiDrqM58qQUFRGPngIgAhsYfzs2MeKfOTaaF3FDj1dqIQsEk8gkT/TrjKvq5DM="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"},"maintainers":[{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"}]},"0.1.2":{"name":"express-routescan","homepage":"http://github.com/anotheri/express-routescan","author":{"name":"Alexander Bykhov","url":"http://github.com/anotheri"},"repository":{"type":"git","url":"http://github.com/anotheri/express-routescan.git"},"description":"Automatic file scanner for Express JS router.","keywords":["express","expressjs","router","route","file","automatic","scanner"],"version":"0.1.2","main":"./index","dependencies":{},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"bugs":{"url":"https://github.com/anotheri/express-routescan/issues"},"_id":"express-routescan@0.1.2","dist":{"shasum":"757b1c160abc4a1ee3fc19d271f3d7342782a172","tarball":"https://registry.npmjs.org/express-routescan/-/express-routescan-0.1.2.tgz","integrity":"sha512-UQUWsFvPt9V5RJo6PqQ5L8wwJoLQQutwI6cFZlW8ER54DGLoOQmGw8HPn15jZCLAnoaBCjEjvAIA3L51ItodAg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGDbTsk1T1/E3hVvLsu72fVxM6VlOf5VE55dtmsuxIbMAiEAzArgwyAUiYZhZO+vNHu2gfsD2DcsfTsKcwoNqErXwrU="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"},"maintainers":[{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"}]},"0.1.3":{"name":"express-routescan","homepage":"http://github.com/anotheri/express-routescan","author":{"name":"Alexander Bykhov","url":"http://github.com/anotheri"},"repository":{"type":"git","url":"http://github.com/anotheri/express-routescan.git"},"description":"Automatic file scanner for Express JS router.","keywords":["express","expressjs","router","route","file","automatic","scanner"],"version":"0.1.3","main":"./index","dependencies":{},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"bugs":{"url":"https://github.com/anotheri/express-routescan/issues"},"_id":"express-routescan@0.1.3","dist":{"shasum":"dff19bc152e93d9aa04dbbf3ea896d8ad1cd290b","tarball":"https://registry.npmjs.org/express-routescan/-/express-routescan-0.1.3.tgz","integrity":"sha512-lOG199uMbgm0XDbM4DT/V5Vts/hMZchploJLBts9gFFJO5Hlusv1AjhTVrwHiQ1afYPxKuP6+/uUR/fu8H8uwg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDbuaQjmER8gkqsPLEi2NMoe7JZc7OHL5s40sAAAXbSIwIhANHAFCyXGeq7a2haAU0eQmIPbBleRaZ8F3NxSZqQ9kVy"}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"},"maintainers":[{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"}]},"0.1.4":{"name":"express-routescan","homepage":"http://github.com/anotheri/express-routescan","author":{"name":"Alexander Bykhov","url":"http://github.com/anotheri"},"repository":{"type":"git","url":"http://github.com/anotheri/express-routescan.git"},"description":"Automatic file scanner for Express JS router.","keywords":["express","expressjs","router","route","file","automatic","scanner"],"version":"0.1.4","main":"./index","dependencies":{},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"bugs":{"url":"https://github.com/anotheri/express-routescan/issues"},"_id":"express-routescan@0.1.4","dist":{"shasum":"9537cc455d28360a5580724b5c390c6e97e91d6e","tarball":"https://registry.npmjs.org/express-routescan/-/express-routescan-0.1.4.tgz","integrity":"sha512-tMKztY9BU2Nj1ZLQdLSOwGXUurHy8nQhF9EnhP6Eq44Kj7Pu7OT0Xd4MuXS+id2xUbP5BhFk0pDQIRApjNGP3w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDUEwExuggvl9wkcdyNpMhfzZYqNXEVVkzrK8OGUwdJnAiEAtW3I3d+MqtY10GCSwFc81q55nQJNPA/ucdgfgxkNYa0="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"},"maintainers":[{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"}]},"0.1.5":{"name":"express-routescan","homepage":"http://github.com/anotheri/express-routescan","author":{"name":"Alexander Bykhov","url":"http://github.com/anotheri"},"repository":{"type":"git","url":"http://github.com/anotheri/express-routescan.git"},"description":"Automatic file scanner for Express JS router.","keywords":["express","expressjs","router","route","file","automatic","scanner"],"version":"0.1.5","main":"./index","dependencies":{},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"bugs":{"url":"https://github.com/anotheri/express-routescan/issues"},"_id":"express-routescan@0.1.5","dist":{"shasum":"1fb03188e4868d6146030d2fb1c16b24cb6a28cd","tarball":"https://registry.npmjs.org/express-routescan/-/express-routescan-0.1.5.tgz","integrity":"sha512-7Ib1DktnuQJNbjnRI2+se8EKFpZjZ/elNx19zfQzG+wcypjuILSbb/4EMt2IjgojZ6QpDc/VcddiY2kzN0kcfA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAcCEsB1Z/Plw1mUPZwiyK5QuBS7/XutNd319j4hBNeqAiEAw9/yQ6+XOABOQAkAO3T91oWP1+RjhYCBEcivcAbCDMY="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"},"maintainers":[{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"}]},"0.1.6":{"name":"express-routescan","homepage":"http://github.com/anotheri/express-routescan","author":{"name":"Alexander Bykhov","url":"http://github.com/anotheri"},"repository":{"type":"git","url":"http://github.com/anotheri/express-routescan.git"},"description":"Automatic file scanner for Express JS router.","keywords":["express","expressjs","router","route","file","automatic","scanner","override"],"version":"0.1.6","main":"./index","dependencies":{},"devDependencies":{"mocha":"*","should":"*","supertest":"*"},"optionalDependencies":{},"engines":{"node":"*"},"scripts":{"test":"ROUTESCAN_TEST=1 ./node_modules/.bin/mocha --reporter spec"},"bugs":{"url":"https://github.com/anotheri/express-routescan/issues"},"_id":"express-routescan@0.1.6","dist":{"shasum":"c0a3f1f67be8fede64e9e77f1d7c8c3c56ffa51e","tarball":"https://registry.npmjs.org/express-routescan/-/express-routescan-0.1.6.tgz","integrity":"sha512-KHyrz/lD+3K8RT2lhfoswQ6RZytRBYgMvfXpr74BiwEXD7oU5O7a0oE9NtOth/w37fbipZh365PQFQZZgr4gxQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDUr0B4U672BWEE8NmjnshePuPkve8yEwRq+QzGeDmYzwIgA2JGZDD7f8SxyDFo6voogbMD+U7AZYCihi4cQQVrKgI="}]},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"},"maintainers":[{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"}]},"0.1.7":{"name":"express-routescan","homepage":"http://github.com/anotheri/express-routescan","author":{"name":"Alexander Bykhov","url":"http://github.com/anotheri"},"repository":{"type":"git","url":"http://github.com/anotheri/express-routescan.git"},"description":"Automatic file scanner for Express JS router.","keywords":["express","expressjs","router","route","file","automatic","scanner","override"],"version":"0.1.7","main":"./index","dependencies":{},"devDependencies":{"mocha":"*","should":"*","supertest":"*"},"optionalDependencies":{},"engines":{"node":"*"},"scripts":{"test":"ROUTESCAN_TEST=1 ./node_modules/.bin/mocha --reporter spec"},"bugs":{"url":"https://github.com/anotheri/express-routescan/issues"},"_id":"express-routescan@0.1.7","dist":{"shasum":"22b1f14e08a5d129ccd99ffe7177f3d34998c3f3","tarball":"https://registry.npmjs.org/express-routescan/-/express-routescan-0.1.7.tgz","integrity":"sha512-c7A+w9cK4PKBSvnj6gLQPmZmh2LQ3jYlt8ZFCxuhhgm2PJaIOR+hLzKeLrOg3DqYLUlkpPqFRQ8zGP8ceFb4wA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDpNWttv3FFSVmZahmFetz+LRO/Uxw4M3OD6HqsZL4SSQIhAP5tnQMjvRPesidjTvhQlZyh0neS20yBn2cHMmSLe2m2"}]},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"},"maintainers":[{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"}]},"0.1.8":{"name":"express-routescan","homepage":"http://github.com/anotheri/express-routescan","author":{"name":"Alexander Bykhov","url":"http://github.com/anotheri"},"repository":{"type":"git","url":"http://github.com/anotheri/express-routescan.git"},"description":"Automatic file scanner for Express JS router.","keywords":["express","expressjs","router","route","file","automatic","scanner","override"],"version":"0.1.8","main":"./index","dependencies":{},"devDependencies":{"mocha":"*","should":"*","supertest":"*"},"optionalDependencies":{},"engines":{"node":"*"},"scripts":{"test":"ROUTESCAN_TEST=1 ./node_modules/.bin/mocha --reporter spec"},"bugs":{"url":"https://github.com/anotheri/express-routescan/issues"},"_id":"express-routescan@0.1.8","dist":{"shasum":"b88df329da54548b26d5fda9c7b8a4f60610586a","tarball":"https://registry.npmjs.org/express-routescan/-/express-routescan-0.1.8.tgz","integrity":"sha512-IxkoWL4GTfPkeDkQNx9CLghlTWVvfS1RMfvAF1ymsVr+zSyWpI4s4jBAh0/YjSlsouU7DNW27LkyKtWthLjhWA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHEWUEM65I9s4MCN2AawQhlyNC6tUaQPpx/lIN6lQWO9AiEA53jYXTWb7PXkXkqkWmiZi17d3iuZq+z1ka1YMQrm76I="}]},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"},"maintainers":[{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"}]},"0.1.9":{"name":"express-routescan","homepage":"http://github.com/anotheri/express-routescan","author":{"name":"Alexander Bykhov","url":"http://github.com/anotheri"},"repository":{"type":"git","url":"http://github.com/anotheri/express-routescan.git"},"description":"Automatic file scanner for Express JS router.","keywords":["express","expressjs","router","route","file","automatic","scanner","override"],"version":"0.1.9","main":"./index","dependencies":{},"devDependencies":{"mocha":"*","should":"*","supertest":"*"},"optionalDependencies":{},"engines":{"node":"*"},"scripts":{"test":"ROUTESCAN_TEST=1 ./node_modules/.bin/mocha --reporter spec"},"bugs":{"url":"https://github.com/anotheri/express-routescan/issues"},"_id":"express-routescan@0.1.9","dist":{"shasum":"8de6ca2569a8a9e62e62ca22ede617fddd699d51","tarball":"https://registry.npmjs.org/express-routescan/-/express-routescan-0.1.9.tgz","integrity":"sha512-9m7Gql7ZbwCbjNOCqX7SeRCHWOtKyN+p+C4ipPqJ361jreQ7ihwcKJoqKaR3utH8TBSzH9PZ6KkPNymymd5kWQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFwAASHN1jkwH14aiCKkMxi98aOJS8KcxEUDmNByIGIHAiEAqhxbuXi+9+IY6fKmJen9il/20uqnfQdog2JpxC5QCS4="}]},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"},"maintainers":[{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"}]},"0.2.0":{"name":"express-routescan","homepage":"http://github.com/anotheri/express-routescan","author":{"name":"Alexander Bykhov","email":"another.side.of.my.soul@gmail.com","url":"http://github.com/anotheri"},"repository":{"type":"git","url":"http://github.com/anotheri/express-routescan.git"},"description":"Automatic file scanner for Express JS router.","keywords":["express","expressjs","router","route","file","automatic","scanner","override"],"version":"0.2.0","main":"./index","dependencies":{},"devDependencies":{"mocha":"*","should":"*","supertest":"*"},"optionalDependencies":{},"engines":{"node":"*"},"scripts":{"test":"ROUTESCAN_TEST=1 ./node_modules/.bin/mocha --reporter spec"},"bugs":{"url":"https://github.com/anotheri/express-routescan/issues"},"_id":"express-routescan@0.2.0","_shasum":"62718d32951ff9a5a6686b1f68e7e027a65d8a57","_from":".","_npmVersion":"1.4.10","_npmUser":{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"},"maintainers":[{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"}],"dist":{"shasum":"62718d32951ff9a5a6686b1f68e7e027a65d8a57","tarball":"https://registry.npmjs.org/express-routescan/-/express-routescan-0.2.0.tgz","integrity":"sha512-fuT2tKCCVTLLzCd1/iFhkkE5TUFcC28hvLYQ1AiUnIgiR/CRu6hjd2XrjqmCHH3d0JN6NaynQppfm/gZZ0gHHA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICpa9MTO1kCQLeRSrxZyLl+taDGkdP+2QOmOY9aeLW6OAiBXOxYyTqx3p1nQXB4GptCgbjNHEvQxxa1l3yvKXJLUMw=="}]}},"0.2.1":{"name":"express-routescan","homepage":"http://github.com/anotheri/express-routescan","author":{"name":"Alexander Bykhov","email":"another.side.of.my.soul@gmail.com","url":"http://github.com/anotheri"},"repository":{"type":"git","url":"http://github.com/anotheri/express-routescan.git"},"description":"Automatic file scanner for Express JS router.","keywords":["express","expressjs","router","route","file","automatic","scanner","override"],"version":"0.2.1","main":"./index","dependencies":{},"devDependencies":{"mocha":"*","should":"*","supertest":"*"},"optionalDependencies":{},"engines":{"node":"*"},"scripts":{"test":"ROUTESCAN_TEST=1 ./node_modules/.bin/mocha --reporter spec"},"gitHead":"4a0bbf8f9a9451b1244393ceb8977be194c26020","bugs":{"url":"https://github.com/anotheri/express-routescan/issues"},"_id":"express-routescan@0.2.1","_shasum":"54734ac9993b1437728701ecb0de3d164e295111","_from":".","_npmVersion":"2.0.0-beta.0","_npmUser":{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"},"maintainers":[{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"}],"dist":{"shasum":"54734ac9993b1437728701ecb0de3d164e295111","tarball":"https://registry.npmjs.org/express-routescan/-/express-routescan-0.2.1.tgz","integrity":"sha512-NC2aHDcJYE8+Inxu+5Af8FDivqxixftA/Q8EQqM7eX4hfXHd3pwBeqXv/o7gBqo/ctaf4Rq6aPQAQhUIHj6frA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIB3M//qS3DaezEjp4ttRq+nCT707lqQpEUvnDKByO8aiAiEA2PIseebO0hKeLDHWOQdqeroVDX4Ghf/q6zaY1JMgyPI="}]}}},"readme":"# express-routescan\n\nThis [nodejs module](https://npmjs.org/package/express-routescan) is an automatic javascript files\nscanner for Express JS router.\n\n\n## Installation\n\n```\n$ npm install express-routescan\n```\n\n\n## Usage\n\nExpress-routescan module is the simplest way to configure and maintain router for complex express\napplications. You just have to create a 'routes/' folder (default) inside your project and write there\nyour routes.\n\nSo folder structure of your app will be like this:\n\n- app.js\n- routes/\n\t- index.js\n\t- users.js\n\t- transaction/\n\t\t- submit.js\n\nFor correct working you should require express-routescan module and pass _express application_ into\nthe one as first argument:\n\n```javascript\n// app.js\n\n// requires\nvar express = require('express');\nvar routescan = require('express-routescan');\n// …\n\nvar app = express();\n\n// app configuration\n\n// start express-routescan.\nroutescan(app);\n\n// ...\n```\n\n\n### Options\n\nThere are some additional options for express-routesan config:\n\n- `directory` — string or array of strings, default value is `[path.join(__dirname, './routes/')]`, so it's ./routes/ folder inside your project. If you want to use another folder(s), you should start express-routescan module with needed value of `directory` option.\n\n- `ext` – array, default value is `['.js']`. Use `ext` key if you want to redefine an array with valid file extensions.\n\n- `ignoreInvalid` — boolean, default value is `false`. Use `ignoreInvalid: true` if you don't want to get errors about invalid files in your routes folder.\n\n- `verbose` – boolean, default is `false`. This option is using for logging information about scanned files (ignored, invalid, routed).\n\n- `strictMode` – boolean, default is `false`. If it's `true` routes with method `all` and `use` are filtered as invalid.\n\n```javascript\nroutescan(app, {\n\tdirectory: [\n\t\t'./path/to/another/routes/folder/inside/my/project',\n\t\t'./relative/path/to/folder/that/will/be/scanned/second',\n\t\t'/full/path/to/folder/that/will/be/scanned/third'\n\t],\n\text: ['.rt', '.js'], // is for enable scanning for all *.rt and *.js files\n\tignoreInvalid: true, // is for ignoring invalid routes\n\tverbose: true,\n\tstrictMode: true // is for filtering `all`-method and `use`-method routes.\n});\n```\n\n\n## Route files\n\n#### Simple example\n\nIn turn, the simplest route file is a file with `module.exports` and should looks like this one:\n\n```javascript\n'use strict';\n\n/* GET home page. */\n\nmodule.exports = {\n\n\t'/': function(req, res){\n\t\tres.send(\"It's main page of my app.\");\n\t}\n\n};\n```\n\nExpress-routescan ignore invalid routes by default.\n\n#### More complicated example\n\n['get'] is default methods array for route. But you can set optional another `methods` (array\nof HTTP methods described in RFC 2616) and `middleware` function(s):\n\n```javascript\n'use strict';\n\nmodule.exports = {\n\n\t'/': {\n\t\tmethods: ['get'],\n\t\t//callback `fn` function is required\n\t\tfn: function(req, res){\n\t\t\tres.send(\"It's main page of my app. It use GET method.\");\n\t\t}\n\t},\n\n\t'/myAwesomeRouteForGetAndPost': {\n\t\tmethods: ['get', 'post'],\n\t\t//midleware is optional parameter\n\t\tmiddleware: [myMiddlewareFnOne, myMiddlewareFnTwo],\n\t\t//callback `fn` function is required\n\t \tfn: function(req, res){\n\t\t\tres.send(\"It's my awesome answer for GET and POST requests.\");\n\t\t}\n\t},\n\n\t'/myAnotherAwesomeRouteForPostRequest': {\n\t\tmethods: ['post'],\n\t\tmiddleware: [myMiddlewareFnThree],\n\t \tfn: function(req, res){\n\t\t\tres.send(\"It's my another awesome answer only for POST request.\");\n\t\t}\n\t}\n\n};\n```\n\n#### Middleware with USE method (loggers, error handlers, etc)\n\nThe order of the route initialisation is matter. So if you need middleware function that should be done every time _before_ each your routes, you should have the first route defined the next way (it may be defined in file which name start with underscore, e.g. `_logger.js` or '_middleware.js'):\n\n```\n'use strict';\n\n/* GET home page. */\n\nmodule.exports = {\n    'logger': {\n        methods: [ 'use' ],\n        fn: function( req, res, next ){\n            // It'll been done before each of your routes\n            console.log('It has been logged');\n            next();\n        }\n    }\n};\n```\n\nIn case of using `use` method the route name isn't so important, I'd suggest to name it accordingly to the functionality of the handler. So the previous example will be work like this one:\n\n```\napp.use(function( req, res, next ){\n    // It'll be done before each of your routes\n    console.log('It has been logged');\n    next();\n}\n```\n\nBut if you need middleware function that should be defined _after_ all your routes (e.g. error handler) and should be called in case of requested route is undefined (kind of default route), you shouldn't define in the last file of the route folder, or make a new separate file named like last file of the route folder, but it'll work as well. It's much better for maintaining to define your route with `deferred: true` key:\n\n```\n'use strict';\n\n/* GET home page. */\n\nmodule.exports = {\n    'error handler': {\n        methods: [ 'use' ],\n        deferred: true,\n        fn: function( req, res, next ){\n            // It'll be done in case of requested route is undefined\n            res.send('404 Not Found');\n        }\n    }\n};\n```\n\nThe `deferred` key works only with 'use' method and it's used to define middleware function that should be defined after the routes. \n\n\n#### Forced routes (overrides)\n\nIf router already has handler for one route path and one method, other files with the same route path and the same method but scanned later will be ignored. It's a default behaviour of express-routescan. But you can use `forced` key into route definition for overrides of routes that already applied to application. So, if you have a route like the one in \"Simple example\" and you want to override it with another one, just add `forced: true` key into your route definition, e.g.:\n\n```javascript\n'use strict';\n\n/* GET overridden home page. */\n\nmodule.exports = {\n\n\t'/': {\n\t\tforced: true,\n\t\tfn:function(req, res){\n\t\t\tres.send(\"It's overridden main page of my app.\");\n\t\t}\n\t}\n\n};\n```\n\n#### Locked routes (not overridable)\n\nIf you want to protect your route from overrides you should use `locked: true` key into your route definition, e.g.:\n\n```javascript\n'use strict';\n\n/* GET not overridable (even by using forced routes) home page. */\n\nmodule.exports = {\n\n\t'/': {\n\t\tlocked: true,\n\t\tfn:function(req, res){\n\t\t\tres.send(\"It's not overridable main page of my app.\");\n\t\t}\n\t}\n\n};\n```\n\n\n#### Usage RegExp as route\n\nIf you want use RegExp with express-routescan, this example is special for you:\n\n```javascript\n'use strict';\n\nmodule.exports = {\n\n\t'/commits': {\n\t\tregexp: /^\\/commits\\/(\\w+)(?:\\.\\.(\\w+))?$/,\n\t\tfn: function(req, res){\n\t\t\tres.send(\"It's page would match \\\"GET /commits/71dbb9c\\\" as well as \\\"GET /commits/71dbb9c..4c084f9\\\".\");\n\t\t}\n\t}\n\n};\n```\n\n\n## .routeignore\n\nAs was mentioned above express-routescan ignore invalid route-files. Scanner also ignore\nall files except for valid extention array (by default `['.js']`) inside routes folder.\nIf you want to ignore some of _.js_ or other valid files you can use _.routeignore_ file\ninside your routes folder to add ignore rules for scanner. It's easy!\n\nFor example, if you don't want use routes from _'./routes/temp/'_ folder just create\n_'./routes/.routeignore'_ file with next content:\n\n```\ntemp/\n```\n\n\n## License\nThe MIT License (MIT)\n\nCopyright (c) 2013-2014 Alexander Bykhov\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","maintainers":[{"name":"anotheri","email":"another.side.of.my.soul@gmail.com"}],"time":{"modified":"2022-06-17T22:37:14.259Z","created":"2013-09-18T12:23:12.130Z","0.1.0":"2013-09-18T12:23:15.967Z","0.1.1":"2013-09-18T12:34:10.040Z","0.1.2":"2013-09-18T20:12:12.462Z","0.1.3":"2013-09-19T13:36:44.310Z","0.1.4":"2013-09-19T17:07:19.768Z","0.1.5":"2013-09-20T12:51:04.495Z","0.1.6":"2013-09-30T13:36:43.858Z","0.1.7":"2013-10-01T08:36:23.647Z","0.1.8":"2013-10-04T08:16:40.188Z","0.1.9":"2013-10-04T12:07:27.514Z","0.2.0":"2014-05-16T19:00:09.167Z","0.2.1":"2014-08-25T12:33:00.722Z"},"author":{"name":"Alexander Bykhov","email":"another.side.of.my.soul@gmail.com","url":"http://github.com/anotheri"},"repository":{"type":"git","url":"http://github.com/anotheri/express-routescan.git"},"homepage":"http://github.com/anotheri/express-routescan","keywords":["express","expressjs","router","route","file","automatic","scanner","override"],"bugs":{"url":"https://github.com/anotheri/express-routescan/issues"},"readmeFilename":"README.md","users":{"goliatone":true}}