{"id":20054762,"url":"https://github.com/abhi5658/node-mongo-url-shortner","last_synced_at":"2026-04-07T16:32:39.387Z","repository":{"id":42921166,"uuid":"245962434","full_name":"abhi5658/node-mongo-url-shortner","owner":"abhi5658","description":"Try it. (Just to be good, don't fill it up). URL does not work anymore. Do not have paid plan of Heroku","archived":false,"fork":false,"pushed_at":"2023-03-04T06:24:38.000Z","size":229,"stargazers_count":0,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-02T09:25:54.433Z","etag":null,"topics":["bootstrap","dotenv","ejs","env","express","express-js","heroku","heroku-app","heroku-cli","heroku-deployment","middleware","mongo","mongodb","mongoose","node","short","shortid","shortner","shorturl","url"],"latest_commit_sha":null,"homepage":"https://short-url-abhi.herokuapp.com/","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/abhi5658.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":"2020-03-09T06:43:10.000Z","updated_at":"2024-01-07T15:58:51.000Z","dependencies_parsed_at":"2024-11-13T12:43:15.146Z","dependency_job_id":"9f9f7a3f-81d3-426f-b296-0105f11b5822","html_url":"https://github.com/abhi5658/node-mongo-url-shortner","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/abhi5658/node-mongo-url-shortner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhi5658%2Fnode-mongo-url-shortner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhi5658%2Fnode-mongo-url-shortner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhi5658%2Fnode-mongo-url-shortner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhi5658%2Fnode-mongo-url-shortner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abhi5658","download_url":"https://codeload.github.com/abhi5658/node-mongo-url-shortner/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhi5658%2Fnode-mongo-url-shortner/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31520544,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"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":["bootstrap","dotenv","ejs","env","express","express-js","heroku","heroku-app","heroku-cli","heroku-deployment","middleware","mongo","mongodb","mongoose","node","short","shortid","shortner","shorturl","url"],"created_at":"2024-11-13T12:43:09.055Z","updated_at":"2026-04-07T16:32:39.346Z","avatar_url":"https://github.com/abhi5658.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-mongo-url-shortner\n\n### Steps involved:\n- `npm init -y`\n- `npm i express mongoose ejs`\n- `npm i --save-dev nodemon`\n- create `server.js`\n- start script for dev in \"scripts\"\n- serve root at `localhost:5000`\n- `npm run start-dev` -\u003e executes: nodemon server.js\n- create `views` directory\n- create `index.ejs` -\u003e create basic html -\u003e add form, table -\u003e run\n- add bootstrap cdn -\u003e apply bootstrap to form, table -\u003e run\n- create directory `models` for storing db models\n- create `short_url.js` and create schema for urls collection\n- create mongodb connection in `server.js` -\u003e run check\n- `npm i shortid` creates unique short identifier\n- add shortid property in schema\n- add app.use for express urlencode\n- create POST /shortUrls route for taking in URL requests\n- create new object in post request and then redirect -\u003e run\n- add find all short urls in serving root and pass as parameter to index file\n- use shortUrls obejct to fill table to show urls from server -\u003e run\n- create new route for redirecting shortUrl at end of `server.js`\n- find url based on shortUrl, add click, save, redirect if not null -\u003e run\n- create error page in views\n- when short url does not exist, render error with response\n- added app use to send response 204 for favicon request and shifted route log below this\n- install dotenv `npm i dotenv`\n- create .env file for storing db credentials\n- provide arguments to database call using process.env.VARIABLE_NAME\n- issue faced: whenever `username` used as a env variable,  when invoked gave first letter capital of corresponding value. e.g. admin -\u003e Admin\n- :: hence using `user` in this case in environment variables\n\n#### Begins heroku deployment:\n- create heroku account\n- install heroku CLI\n- goto local project git directory\n- login into heroku cli : `heroku login`\n- enter credentials -\u003e login success\n- heroku starts server on port 5000! the code has been designed to accept port from external environment\n- create heroku project: `heroku create app_name` : `heroku create short-url-abhi` : this creates a git project named short-url-abhi assosiated to heroku\n- goto heroku dashboard -\u003e app -\u003e settings -\u003e config vars : add .env variables\n- push commited project to heroku master branch : `git push heroku master` : makes the project live at returned url","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabhi5658%2Fnode-mongo-url-shortner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabhi5658%2Fnode-mongo-url-shortner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabhi5658%2Fnode-mongo-url-shortner/lists"}