{"id":23514747,"url":"https://github.com/niweera/men-pp-template","last_synced_at":"2025-04-19T14:41:02.619Z","repository":{"id":99711560,"uuid":"250368824","full_name":"Niweera/men-pp-template","owner":"Niweera","description":"MongoDB, Express, NodeJS template with Passport authentication.","archived":false,"fork":false,"pushed_at":"2022-12-22T15:02:21.000Z","size":92,"stargazers_count":12,"open_issues_count":4,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T08:43:52.462Z","etag":null,"topics":["express","javascript","jsonwebtoken","mongodb","mongoose","nodejs","passportjs"],"latest_commit_sha":null,"homepage":null,"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/Niweera.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-26T20:50:32.000Z","updated_at":"2025-02-17T00:14:38.000Z","dependencies_parsed_at":"2023-07-31T14:15:29.668Z","dependency_job_id":null,"html_url":"https://github.com/Niweera/men-pp-template","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Niweera%2Fmen-pp-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Niweera%2Fmen-pp-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Niweera%2Fmen-pp-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Niweera%2Fmen-pp-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Niweera","download_url":"https://codeload.github.com/Niweera/men-pp-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249716425,"owners_count":21315066,"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","javascript","jsonwebtoken","mongodb","mongoose","nodejs","passportjs"],"created_at":"2024-12-25T14:10:20.142Z","updated_at":"2025-04-19T14:41:02.613Z","avatar_url":"https://github.com/Niweera.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Open Source Love](https://img.shields.io/badge/Open%20Source-%E2%9D%A4-red.svg)\n![GitHub](https://img.shields.io/github/license/Niweera/men-pp-template.svg)\n\n# men-pp-template\n\nMongoDB, Express, NodeJS template with Passport authentication.\n\n# How to use\n\n1.  Clone repo\n2.  `npm i`\n3.  `npm i -g pm2`\n4.  Remeber to change config in `ecosystem.config.js`.\n5.  `pm2 start`\n6.  To view logs: `pm2 logs`\n\n## ecosystem.config.js file\n\n```javascript\nmodule.exports = {\n  apps: [\n    {\n      name: \"men-pp-template\",\n      script: \"./index.js\",\n      watch: true,\n      args: [\"--color\"],\n      instances: 1,\n      exec_mode: \"cluster\",\n      env: {\n        HTTP_PORT: 8080,\n        NODE_ENV: \"development\",\n        MONGO_URI: `mongodb://localhost:27017/sample-db`,\n        JWT_SECRET: \"supersecret\",\n        BCRYPT_ROUNDS: 10,\n        VERIFY_ALGORITHM: [\"HS256\"],\n        TOKEN_ISSUER: \"server\",\n        JWT_EXPIRES_IN: \"1h\",\n        SIGN_ALGORITHM: \"HS256\"\n      }\n    }\n  ]\n};\n```\n\n# How to edit\n\n| File                    | Functionality                                            |\n| :---------------------- | :------------------------------------------------------- |\n| `/controllers/index.js` | To add API endpoints                                     |\n| `/middleware/index.js`  | To add middlewares to the Express app                    |\n| `/models/index.js`      | To add Mongoose schemas and @Hapi/Joi validation schemas |\n| `/services/index.js`    | To add functions to the controllers                      |\n| `/keys/index.js`        | To add ENV variables                                     |\n\n# API endpoints\n\n| Method | Endpoint     | Description                              | Examples                                                                                                                                   |\n| :----- | :----------- | :--------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------- |\n| `GET`  | `/`          | Welcome message                          | [`http:localhost:8080/`](http:localhost:8080/)                                                                                             |\n| `GET`  | `/usernames` | Get all usernames (needs authentication) | [`http:localhost:8080//usernames`](http:localhost:8080/usernames)                                                                          |\n| `POST` | `/sign-up`   | Sign up                                  | [`http:localhost:8080//sign-up`](http:localhost:8080/sign-up) \u003cbr\u003e Body parameters: \u003cbr\u003e `{\"username\" : \"Niweera\", \"password\" : \"secret\"}` |\n| `POST` | `/sign-in`   | Sign in                                  | [`http:localhost:8080//sign-in`](http:localhost:8080/sign-in) \u003cbr\u003e Body parameters: \u003cbr\u003e `{\"username\" : \"Niweera\", \"password\" : \"secret\"}` |\n\n# Resources:\n\n1. [PM2 Docs](https://pm2.keymetrics.io/docs/usage/quick-start/)\n2. [Mongoose Docs](https://mongoosejs.com/docs/index.html)\n3. [Passport Docs](http://www.passportjs.org/docs/downloads/html/)\n4. [Joi Docs](https://hapi.dev/module/joi/)\n5. [jsonwebtoken Docs](https://github.com/auth0/node-jsonwebtoken/blob/master/README.md)\n\n### PRs are welcome\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniweera%2Fmen-pp-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fniweera%2Fmen-pp-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniweera%2Fmen-pp-template/lists"}