{"id":28974859,"url":"https://github.com/plcoster/fcc_backend_project3","last_synced_at":"2026-04-17T03:01:35.252Z","repository":{"id":57904010,"uuid":"529032681","full_name":"PLCoster/fcc_backend_project3","owner":"PLCoster","description":"FreeCodeCamp Backend Project 3: URL Shortener Microservice","archived":false,"fork":false,"pushed_at":"2022-08-25T23:04:22.000Z","size":128,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-24T12:16:53.433Z","etag":null,"topics":["express","mongoose"],"latest_commit_sha":null,"homepage":"https://fcc-backend-project3.plcoster.repl.co/","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/PLCoster.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}},"created_at":"2022-08-25T22:08:21.000Z","updated_at":"2022-08-25T22:14:28.000Z","dependencies_parsed_at":"2022-08-26T02:24:07.345Z","dependency_job_id":null,"html_url":"https://github.com/PLCoster/fcc_backend_project3","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PLCoster/fcc_backend_project3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLCoster%2Ffcc_backend_project3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLCoster%2Ffcc_backend_project3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLCoster%2Ffcc_backend_project3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLCoster%2Ffcc_backend_project3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PLCoster","download_url":"https://codeload.github.com/PLCoster/fcc_backend_project3/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLCoster%2Ffcc_backend_project3/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31913078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"online","status_checked_at":"2026-04-17T02:00:06.879Z","response_time":62,"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":["express","mongoose"],"created_at":"2025-06-24T12:07:11.269Z","updated_at":"2026-04-17T03:01:35.207Z","avatar_url":"https://github.com/PLCoster.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Free Code Camp: Backend Project 3 - URL Shortener Microservice\n\n## URL Shortener Microservice\n\nThe aim of this project was to build a small web app with functionality similar to: https://url-shortener-microservice.freecodecamp.rocks\n\nThe project was built using the following technologies:\n\n- **HTML**\n- **JavaScript** with **[Node.js](https://nodejs.org/en/) / [NPM](https://www.npmjs.com/)** for package management.\n- **[Express](https://expressjs.com/)** web framework to build the web API.\n- **[mongoose](https://mongoosejs.com/)** for MongoDB object modeling, interacting with a **[MongoDB Atlas](https://www.mongodb.com/atlas/database)** database.\n- **[Bootstrap](https://getbootstrap.com/)** for styling with some custom **CSS**.\n- **[FontAwesome](https://fontawesome.com/)** for icons.\n- **[nodemon](https://nodemon.io/)** for automatic restarting of server during development.\n\n### Project Requirements:\n\n- **User Story #1:** You can POST a URL to `/api/shorturl` and get a JSON response with `original_url` and `short_url` properties. Here's an example: `{ original_url : 'https://freeCodeCamp.org', short_url : 1}`\n\n- **User Story #2:** When you visit `/api/shorturl/\u003cshort_url\u003e`, you will be redirected to the original URL.\n\n- **User Story #3:** If you pass an invalid URL that doesn't follow the valid `http://www.example.com` format, the JSON response will contain `{ error: 'invalid url' }`\n\n### Project Writeup:\n\nThe third Free Code Camp: Back End Development Project is a URL shortener microservice. Users can:\n\n- Submit a URL to be shortened using the form on the app home page, or by sending a POST request to `/api/shorturl` with a urlencoded body containing the field 'url' containing a valid URL.\n\n- Be redirected to the original URL by sending a GET request to `/api/shorturl/\u003cSHORT_URL\u003e` where `SHORT_URL` is the `short_url` string returned via JSON when a URL to be shortened is submitted.\n\nShortened URL records are stored in a MongoDB database, and expire after 24hrs.\n\n### Project Files:\n\n- `index.js` - the main entry point of the application, an express web server handling the routes defined in the specification.\n\n- `public/` - contains static files for the web app (stylesheet, logo, favicons etc), served by express using `express.static()`.\n\n- `views/` - contains the single html page for the web app, `index.html`, which is served by express on `GET` requests to `/`.\n\n- `middleware/` - contains express middleware functions used by the two major routes of the express server.\n\n- `models/` - contains `mongoose` schema and models for the database interactions of the app.\n\n- `helpers/` - contains two small helper files used by some of the middleware functions.\n\n### Usage:\n\nRequires Node.js / NPM in order to install required packages. After downloading the repo, install required dependencies with:\n\n`npm install`\n\nTo run the app locally, a valid MongoDB database URI is required to be entered as an environmental variable (MONGO_URI), which can be done via a `.env` file (see sample.env). One possible MongoDB service is **[MongoDB Atlas](https://www.mongodb.com/atlas/database)**.\n\nA development mode (with auto server restart on file save), can be started with:\n\n`npm run dev`\n\nThe application can then be viewed at `http://localhost:3000/` in the browser.\n\nTo start the server without auto-restart on file save:\n\n`npm start`\n\n# URL Shortener Microservice BoilerPlate\n\nThe initial boilerplate for this app can be found at https://url-shortener-microservice.freecodecamp.rocks/\n\nInstructions for building the project can be found at https://www.freecodecamp.org/learn/back-end-development-and-apis/back-end-development-and-apis-projects/url-shortener-microservice\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplcoster%2Ffcc_backend_project3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplcoster%2Ffcc_backend_project3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplcoster%2Ffcc_backend_project3/lists"}