{"id":30852501,"url":"https://github.com/chfern/express-route-group","last_synced_at":"2026-05-14T20:33:01.077Z","repository":{"id":106048477,"uuid":"159776377","full_name":"chfern/express-route-group","owner":"chfern","description":"🚦 NPM module to help express route grouping.","archived":false,"fork":false,"pushed_at":"2022-12-09T07:59:25.000Z","size":23,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-07T08:21:04.688Z","etag":null,"topics":["library","nodejs","production"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chfern.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-11-30T06:05:52.000Z","updated_at":"2020-02-05T09:20:38.000Z","dependencies_parsed_at":"2023-11-07T00:47:11.927Z","dependency_job_id":"311c3ecb-fd83-497c-a3bb-0742cbf01dce","html_url":"https://github.com/chfern/express-route-group","commit_stats":null,"previous_names":["chfern/express-route-group"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chfern/express-route-group","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chfern%2Fexpress-route-group","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chfern%2Fexpress-route-group/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chfern%2Fexpress-route-group/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chfern%2Fexpress-route-group/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chfern","download_url":"https://codeload.github.com/chfern/express-route-group/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chfern%2Fexpress-route-group/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33042184,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["library","nodejs","production"],"created_at":"2025-09-07T08:05:36.026Z","updated_at":"2026-05-14T20:33:01.062Z","avatar_url":"https://github.com/chfern.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# express-route-group\n\nThis package enables express users to create a seperate file for their routes, and group routes by prefix.\n\n# Installation\n\nThis is a node module and is available for install through npm\n```\nnpm install express-route-group\n```\n\n# Usage\n### index.js - Basic express configuration\nHere, you create a basic express configuration then calling the function ```registerRoutes``` from routes.js (example below).  \nWe pass the application instance returned from calling ```express()``` here.\n```javascript\nconst express = require('express');\nconst app = express();\nconst bodyParser = require('body-parser');\n\napp.use(bodyParser.json());\napp.use(bodyParser.urlencoded({extended: true}));\n\n// Registers routes for your application\nconst {registerRoutes} = require('./routes');\nregisterRoutes(app);\n\nconst PORT = process.env.PORT || 8081;\napp.listen(PORT, function(){\n  console.log(`Server starting on port ${PORT}`);\n})\n```\n\n### routes.js\nYou may declare your route groups with these functions:\n```\napp.use(prefix, routes_arr)\n```\n```\napp.use(prefix, middlewares_arr, routes_arr)\n```  \n\nAnd to register the routes inside a route group, you can use these functions: \n```\nRoute.get(endpoint, callback)\n```\n```\nRoute.post(endpoint, callback)\n```\n```\nRoute.put(endpoint, callback)\n```\n```\nRoute.patch(endpoint, callback)\n```\n```\nRoute.delete(endpoint, callback)\n```\n\nExample : \n```javascript\nconst Route = require('express-route-group');\n\nmodule.exports.registerRoutes = function(app) {\n/*\n  * Register your routes here\n  * app.use(prefix, routes_arr)\n  * app.use(prefix, middlewares_arr, routes_arr)\n  */\napp.use('/test',\n  Route.routes([\n      Route.get('/helloworld', async (req, res, next) =\u003e {\n        res.send({ 'message': 'Hello World!' });\n      })\n  ]));\n}\n```\nTry starting the webserver then go to localhost:8081/test/helloworld, you should see the JSON returned.\n\n\n### Registering Multiple Routes \u0026 Route Groups (routes.js)\n```javascript\nconst Route = require('express-route-group');\n\nmodule.exports.registerRoutes = function(app) {\n  app.use('/v1',\n    Route.routes([\n        Route.get('/todos', async (req, res, next) =\u003e {\n          res.send({ 'message': 'Hello World!' });\n        })\n    ]));\n\n  app.use('/v2',\n    Route.routes([\n        Route.get('/todos', async (req, res, next) =\u003e {\n          res.send({ 'message': 'Hello World!' });\n        }),\n        Route.get('/todos/:id', async (req, res, next) =\u003e {\n          res.send({ 'message': 'Hello World!' });\n        })\n    ]));\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchfern%2Fexpress-route-group","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchfern%2Fexpress-route-group","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchfern%2Fexpress-route-group/lists"}