{"id":19538092,"url":"https://github.com/nirmit27/link-shrink","last_synced_at":"2026-04-13T01:03:52.368Z","repository":{"id":256255192,"uuid":"853752265","full_name":"nirmit27/link-shrink","owner":"nirmit27","description":"A RESTful API for shortening long URLs built using Express and MongoDB.","archived":false,"fork":false,"pushed_at":"2024-12-05T17:12:47.000Z","size":328,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-08T18:16:02.459Z","etag":null,"topics":["api","api-rest","crypto","express","express-middleware","expressjs","link-shortener","link-shortener-api","link-shortener-backend","link-shortener-server","mongodb","mongodb-atlas","node-crypto"],"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/nirmit27.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":"2024-09-07T12:44:56.000Z","updated_at":"2024-12-26T03:04:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"6a682244-1e90-4b84-9dd1-e48db99e3f41","html_url":"https://github.com/nirmit27/link-shrink","commit_stats":null,"previous_names":["nirmit27/link-shrink"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirmit27%2Flink-shrink","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirmit27%2Flink-shrink/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirmit27%2Flink-shrink/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirmit27%2Flink-shrink/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nirmit27","download_url":"https://codeload.github.com/nirmit27/link-shrink/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240793229,"owners_count":19858623,"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":["api","api-rest","crypto","express","express-middleware","expressjs","link-shortener","link-shortener-api","link-shortener-backend","link-shortener-server","mongodb","mongodb-atlas","node-crypto"],"created_at":"2024-11-11T02:31:26.770Z","updated_at":"2026-04-13T01:03:52.329Z","avatar_url":"https://github.com/nirmit27.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Link Shortener API\n\nA simple and efficient **RESTful API** built with **Express.js** to shorten, manage, and retrieve URLs. This API enables users to generate short URLs, retrieve the original URLs, and redirect to the original webpage.\n\n## Features\n\n- Generates an **8-character** hash code for long URLs.\n- Retrieves the original URL using the short code.\n- Redirects to the original webpage using the short code.\n\n## API Reference\n\n### 1. Generate Short URL\nAccepts a long URL in **JSON** format and returns an 8-character hash code as the shortened URL.\n  ```http\n  POST /shrink\n  ```\n\n| Parameter | Type     | Description                                 |\n| :-------- | :------- | :------------------------------------------ |\n| `longUrl` | `string` | **Required.** The long URL to be shortened. |\n\n**Request :**\n```json\n{  \n  \"longUrl\": \"https://example.com/long-url\"  \n}\n```\n\n**Response :**\n```json\n{  \n  \"shortCode\": \"example123\"  \n}  \n```\n\n### 2. Retrieve Original URL\nTakes an 8-character hash code as a **path** parameter and returns the corresponding long URL.\n  ```http\n  GET /url/:code\n  ```\n\n| Parameter | Type     | Description                                               |\n| :-------- | :------- | :-------------------------------------------------------- |\n| `url`     | `string` | **Required.** 8-character hash code of the shortened URL. |\n\n**Response :**\n```json\n{  \n  \"longUrl\": \"https://example.com/long-url\"  \n}\n```\n\n\n### 3. Redirect to Original URL\nRedirects to the **original** long URL corresponding to the provided 8-character hash code.\n  ```http\n  GET /visit/:code\n  ```\n\n| Parameter | Type     | Description                                                   |\n| :-------- | :------- | :------------------------------------------------------------ |\n| `code`    | `string` | **Required.** The 8-character hash code of the shortened URL. |\n\n\n## Installation and Setup\n\n### Prerequisites\n- [Node.js](https://nodejs.org/en/download)\n- [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) or [yarn](https://classic.yarnpkg.com/lang/en/docs/install/#windows-stable)\n\n### Installation\n\n  #### 1. Clone the repository :\n  ```bash\n  git clone https://github.com/nirmit27/link-shrink.git\n  ```\n\n#### 2. Navigate to the project directory :\n  ```bash\n  cd link-shrink\n  ```\n\n#### 3. Install dependencies :\n  ```bash\n  npm install\n  ```\n\n#### Running the development server\n  ```bash\n  node index.js\n  ```\nThe **API** will be available at http://localhost:3000.\n\n## Tech Stack\n\n[![Node.js](https://img.shields.io/badge/Nodejs-43853D?style=for-the-badge\u0026logo=node.js\u0026logoColor=white)](https://nodejs.org/en)\u0026nbsp;\n[![Express.js](https://img.shields.io/badge/Expressjs-404D59?style=for-the-badge\u0026logo=express\u0026logoColor=white)](https://expressjs.com/)\u0026nbsp;\n[![MongoDB](https://img.shields.io/badge/MongoDB-4EA94B?style=for-the-badge\u0026logo=mongodb\u0026logoColor=white)](https://www.mongodb.com/)\u0026nbsp;\n[![Vercel](https://img.shields.io/badge/Vercel-000000?style=for-the-badge\u0026logo=vercel\u0026logoColor=white)](https://vercel.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnirmit27%2Flink-shrink","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnirmit27%2Flink-shrink","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnirmit27%2Flink-shrink/lists"}