{"id":21121438,"url":"https://github.com/oneofone/dynamic-routes","last_synced_at":"2026-04-02T16:03:15.938Z","repository":{"id":10295415,"uuid":"12415939","full_name":"OneOfOne/dynamic-routes","owner":"OneOfOne","description":"Dynamic routes for Express.JS","archived":false,"fork":false,"pushed_at":"2016-04-29T01:58:52.000Z","size":17,"stargazers_count":4,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-09T05:03:04.289Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OneOfOne.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-08-27T19:49:12.000Z","updated_at":"2021-01-30T20:22:50.000Z","dependencies_parsed_at":"2022-09-12T04:42:22.584Z","dependency_job_id":null,"html_url":"https://github.com/OneOfOne/dynamic-routes","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/OneOfOne/dynamic-routes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OneOfOne%2Fdynamic-routes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OneOfOne%2Fdynamic-routes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OneOfOne%2Fdynamic-routes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OneOfOne%2Fdynamic-routes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OneOfOne","download_url":"https://codeload.github.com/OneOfOne/dynamic-routes/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OneOfOne%2Fdynamic-routes/sbom","scorecard":{"id":104851,"data":{"date":"2025-08-11","repo":{"name":"github.com/OneOfOne/dynamic-routes","commit":"6d7a4f5e78a1d22caa5112446e64eec3c48aef5c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":2,"reason":"Found 3/12 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-15T10:54:36.726Z","repository_id":10295415,"created_at":"2025-08-15T10:54:36.726Z","updated_at":"2025-08-15T10:54:36.726Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31309586,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-20T03:50:18.163Z","updated_at":"2026-04-02T16:03:15.909Z","avatar_url":"https://github.com/OneOfOne.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dynamic-routes\n\n\u003e A dynamic router / loader for http://expressjs.com/\n\n## Install\n\n``` bash\nnpm install dynamic-routes --save\n```\n\n\n## Usage\n\n\u003e **DynamicRoutes(app, path_to_routes, [options])**\n\n\n## Examples :\n\n#### Express.JS Server :\n\n```js\nvar express = require('express'),\n\thttp = require('http'),\n\tpath = require('path'),\n\tDynamicRoutes = require('dynamic-routes'),\n\tapp = express();\n\napp.set('port', process.env.PORT || 3000);\napp.set('views', __dirname + '/views');\napp.use(express.logger('dev'));\napp.use(bodyParser());\napp.use(express.methodOverride());\napp.use(express.cookieParser('secrets secrets, we got extra'));\napp.use(express.session());\napp.use(app.router);\napp.use(express.static(path.join(__dirname, 'public')));\n\nif ('development' == app.get('env')) {\n\tapp.use(express.errorHandler());\n}\n\nDynamicRoutes(app, __dirname + '/routes/');\n// or\n\n/*\nDynamicRoutes(app, {\n\tsrc: __dirname + '/routes/',\n\tignore: [],\n\tpattern: /\\.js$/\n});\n*/\n\nhttp.createServer(app).listen(app.get('port'), function(){\n\tconsole.log('Express server listening on port ' + app.get('port'));\n});\n\n```\n#### Creating compatible routes :\n\n##### Using an object :\n\n```js\n//routes/index.js\nmodule.exports = {\n\tpriority: 1000, //this is the `/` handler, therefore it should be the last route.\n\tpath: '/',\n\n\t//this function gets passed the express object one time for any extra setup\n\tinit: function(app) {\n\t\t\n\t},\n    \n    //a middleware that is called from any HTTP methods\n    ALL: function(req, res, next) {\n        res.send(' - Common Middleware -');\n        next();\n    }\n    \n    //HTTP method specific routes\n\tGET: function(req, res) {\n\t\tres.end('GET ');\n\t},\n\t\n\tPOST: function(req, res) {\n        res.json(req.body);\n        res.end('POST ');\n\t},\n    \n    //routes supports GET, HEAD, POST, PUT, DELETE, OPTIONS, TRACE, PATCH method(all uppercase)\n};\n```\n\n##### Routing multiple middlewares by assigning an array of middlewares :\n\n```js\nmodule.exports = {\n    priority: 1000,\n    path: '/',\n    \n    init: function(app){\n        \n    }\n    \n    ALL: [\n        function(req, res, next){\n            res.send(' - Common Middleware 1 - ');\n            next();\n        },\n        function(req, res, next){\n            res.send(' - Common Middleware 2 - ');\n            next();\n        }\n    ],\n    \n    GET: [\n        function(req, res, next){\n            res.send(' GET 1 ');\n            next();\n        },\n        function(req, res){\n            res.end('end of GET');\n        }\n    ],\n    \n    POST: [\n        function(req, res){\n            res.json(req.body);\n            res.end('end of POST');\n        }\n    ]\n    /* an array with single route, that is equivalent to\n    \n    POST: function(req, res){\n        res.json(req.body);\n        res.end('end of POST');\n    }\n    \n    */\n}\n\n```\n\n##### Using a function :\n\n```js\nvar user = module.exports = function(app) {\n\t\"use strict\";\n\t//other setup\n\tapp.get(function(req, res) {\n\t\tres.json({'user': [req.params.id, req.params, req.query, req.body]});\n\t});\n};\n\nuser.priority = 1;\nuser.path = '/user/:id?';\n\n```\n\n##### This is equivalent to :\n\n\n```js\nmodule.exports = {\n\tpath: '/user/:id?',\n\tpriority: 1,\n\tinit: function (app) {\n\t\t//setup db\n\t},\n\t\n\tGET: function(req, res) {\n\t\tres.json({'user': [req.params.id, req.params, req.query, req.body]});\n\t}\n}\n```\n\n## Notes\n- As of Express 4.x, it's recommended to use `require('body-parser')()` instead of `express.bodyParser()`, check [`this`](http://stackoverflow.com/questions/5710358/how-to-get-post-query-in-express-node-js/20132867#20132867).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foneofone%2Fdynamic-routes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foneofone%2Fdynamic-routes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foneofone%2Fdynamic-routes/lists"}