{"id":20345555,"url":"https://github.com/mahendran-balaji/setup-env-for-nodejs-project","last_synced_at":"2026-05-08T11:39:42.779Z","repository":{"id":183150650,"uuid":"669586566","full_name":"Mahendran-Balaji/setup-env-for-nodejs-project","owner":"Mahendran-Balaji","description":"Setup ENV for nodejs Project","archived":false,"fork":false,"pushed_at":"2023-07-23T18:35:27.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-14T20:59:54.858Z","etag":null,"topics":["dotenv","nodejs"],"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/Mahendran-Balaji.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-22T19:00:48.000Z","updated_at":"2023-07-25T18:17:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"a7971368-ca8e-4a21-9975-067815d2d200","html_url":"https://github.com/Mahendran-Balaji/setup-env-for-nodejs-project","commit_stats":null,"previous_names":["mahendran-balaji/env_for_nodejs","mahendran-balaji/setup-env-for-nodejs-project"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mahendran-Balaji%2Fsetup-env-for-nodejs-project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mahendran-Balaji%2Fsetup-env-for-nodejs-project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mahendran-Balaji%2Fsetup-env-for-nodejs-project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mahendran-Balaji%2Fsetup-env-for-nodejs-project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mahendran-Balaji","download_url":"https://codeload.github.com/Mahendran-Balaji/setup-env-for-nodejs-project/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241876528,"owners_count":20035396,"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":["dotenv","nodejs"],"created_at":"2024-11-14T22:08:56.425Z","updated_at":"2026-05-08T11:39:42.726Z","avatar_url":"https://github.com/Mahendran-Balaji.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\r\n## Setup .env for Node JS project\r\n\r\nStep 1: Setup new npm package\r\n\r\n```bash\r\n  npm init\r\n```\r\nStep 2 : Install the following package: dotenv\r\n\r\n```bash\r\n npm install dotenv\r\n```\r\nStep 3: Create a new .env file in the root directory\r\n\r\nStep 4: Add Following Code into the .env file\r\n\r\n```javascript\r\nPORT_NUMBER=3000\r\n```\r\nStep 5 : To create index.js file add following code\r\n\r\n```javascript\r\nconst path = require('path');\r\nconst express = require(\"express\");\r\nconst app = express();\r\nconst dotenv = require(\"dotenv\").config({path:path.resolve('.env')});\r\nconst env = dotenv.parsed;\r\n\r\nconst portNumber = env.PORT_NUMBER;\r\n\r\napp.get(\"/\", (req, res) =\u003e {\r\n  res.send(\"Hello Friends!\");\r\n});\r\n\r\napp.listen(portNumber, () =\u003e {\r\n  console.log(`Example app listening on port ${portNumber}!`);\r\n});\r\n\r\n```\r\nStep 6: Run the application\r\n\r\n```bash\r\n  node index.js\r\n```\r\n\r\n## Author\r\n\r\n- [@Mahendran-Balaji](https://github.com/Mahendran-Balaji/)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahendran-balaji%2Fsetup-env-for-nodejs-project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmahendran-balaji%2Fsetup-env-for-nodejs-project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahendran-balaji%2Fsetup-env-for-nodejs-project/lists"}