{"id":15190618,"url":"https://github.com/marcus-sa/express-atlas","last_synced_at":"2025-10-02T06:32:03.010Z","repository":{"id":57231781,"uuid":"90061823","full_name":"marcus-sa/express-atlas","owner":"marcus-sa","description":"A simple routing wrapper for Express built on directory and file pattern recognition with easy import of mongoose models","archived":true,"fork":false,"pushed_at":"2018-09-21T20:26:36.000Z","size":53,"stargazers_count":1,"open_issues_count":7,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-14T01:49:53.097Z","etag":null,"topics":["express","mongoose-model","nodejs","pattern-recognition","routing"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/express-atlas","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcus-sa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-02T17:51:24.000Z","updated_at":"2023-01-28T14:48:25.000Z","dependencies_parsed_at":"2022-09-13T21:00:44.728Z","dependency_job_id":null,"html_url":"https://github.com/marcus-sa/express-atlas","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcus-sa%2Fexpress-atlas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcus-sa%2Fexpress-atlas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcus-sa%2Fexpress-atlas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcus-sa%2Fexpress-atlas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcus-sa","download_url":"https://codeload.github.com/marcus-sa/express-atlas/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234951819,"owners_count":18912476,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["express","mongoose-model","nodejs","pattern-recognition","routing"],"created_at":"2024-09-27T20:43:06.681Z","updated_at":"2025-10-02T06:31:57.722Z","avatar_url":"https://github.com/marcus-sa.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Express Atlas\n\nA simple and easy-to-use routing wrapper for Express built on directory and file pattern recognition\n\n* Works with both ES6 and CommonJS\n\n## Installation\n```$ npm install express-atlas```\n\n## Documentation\n\n### Initialization\n\n#### Without Mongoose\n```javascript\nimport express from 'express'\nimport AtlasRouter from 'express-atlas'\n\nconst app = express()\n\nnew AtlasRouter({\n  controllers: './controllers' // Path to controllers directory\n  express: app\n})\n```\n\n#### With Mongoose\nAll Mongoose models will automatically be imported\n\n```javascript\nimport express from 'express'\nimport AtlasRouter from 'express-atlas'\nimport mongoose from 'mongoose'\n\nconst app = express()\n\nnew AtlasRouter({\n  controllers: './controllers' // Path to controllers directory\n  express: app,\n  mongoose: ['./models', mongoose] // arg1 path to models, arg2 mongoose module itself\n})\n```\n\n### Routes\nRecognition is based on:\n* Directories\n* Filename\n* Params\n* Method\n\nIncase of having multiple route names where a post and get request is being called, it's separated by the route extension instead of ```method: 'post'```\n\n* ```{root} \u003e controllers \u003e auth \u003e login.js```\nWill become:\n```www.example.com/auth/login```\n\n* ```{root} \u003e controllers \u003e auth \u003e login-post.js```\nWill become the same, but with a **post** request\n\n* ```{root} \u003e controllers \u003e api \u003e index.js```\nWill become:\n```www.example.com/api```\n\n\n#### Routes without Mongoose\n```javascript\nexport default {\n  method: 'get', // request type\n\n  action: function (req, res) { // action to be called\n    ...\n  }\n}\n```\n\n\n#### Routes with Mongoose\n```javascript\nexport default {\n  method: 'get', // request type\n  params: ':title', // params\n  model: 'News' // Mongoose model name\n\n  action: function (req, res, next, News) { // action to be called\n    const {title} = req.params\n\n    News.findOne({title: title}, (err, data) =\u003e {\n      if (err) throw err\n\n      if (data) {\n        res.json(data)\n      } else {\n        res.send(`Nothing find for: ${title}`)\n      }\n    })\n  }\n}\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcus-sa%2Fexpress-atlas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcus-sa%2Fexpress-atlas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcus-sa%2Fexpress-atlas/lists"}