{"id":27115169,"url":"https://github.com/sunjay-dev/url-shortener-using-json-file","last_synced_at":"2026-02-09T11:04:05.629Z","repository":{"id":258788747,"uuid":"875708931","full_name":"sunjay-dev/URL-Shortener-using-json-file","owner":"sunjay-dev","description":"URL shortener utilizes a JSON file for storage to create and manage short URLs.","archived":false,"fork":false,"pushed_at":"2024-12-16T18:30:57.000Z","size":206,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T04:54:22.484Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","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/sunjay-dev.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":"2024-10-20T16:44:20.000Z","updated_at":"2024-12-16T18:31:00.000Z","dependencies_parsed_at":"2024-10-20T20:13:37.763Z","dependency_job_id":null,"html_url":"https://github.com/sunjay-dev/URL-Shortener-using-json-file","commit_stats":null,"previous_names":["sunjay-dev/url-shortener-using-json-file"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sunjay-dev/URL-Shortener-using-json-file","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunjay-dev%2FURL-Shortener-using-json-file","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunjay-dev%2FURL-Shortener-using-json-file/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunjay-dev%2FURL-Shortener-using-json-file/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunjay-dev%2FURL-Shortener-using-json-file/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunjay-dev","download_url":"https://codeload.github.com/sunjay-dev/URL-Shortener-using-json-file/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunjay-dev%2FURL-Shortener-using-json-file/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268319431,"owners_count":24231798,"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","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"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":[],"created_at":"2025-04-07T04:54:24.916Z","updated_at":"2026-02-09T11:04:05.569Z","avatar_url":"https://github.com/sunjay-dev.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# URL Shortener Using JSON File As Storage\n\nA simple URL shortener built with Node.js and Express.js that stores shortened URLs in a JSON file. This project allows users to create short URLs and redirect to the original URLs.\n\n## Features\n\n- Shorten long URLs and access them using a shorter link.\n- Store and manage URL mappings in a JSON file.\n- Enhanced Error handling.\n\n## Technologies Used\n![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge\u0026logo=node.js\u0026logoColor=white) ![Express.js](https://img.shields.io/badge/express.js-%23404d59.svg?style=for-the-badge\u0026logo=express\u0026logoColor=%2361DAFB) ![NPM](https://img.shields.io/badge/NPM-%23CB3837.svg?style=for-the-badge\u0026logo=npm\u0026logoColor=white) ![HTML5](https://img.shields.io/badge/html5-%23E34F26.svg?style=for-the-badge\u0026logo=html5\u0026logoColor=white) ![CSS3](https://img.shields.io/badge/css3-%231572B6.svg?style=for-the-badge\u0026logo=css3\u0026logoColor=white) ![JavaScript](https://img.shields.io/badge/javascript-%23323330.svg?style=for-the-badge\u0026logo=javascript\u0026logoColor=%23F7DF1E)\n- Node.js\n- Express.js\n- shortid (For creating short id for url)\n- NPM (For downloading dependencies)\n- Html/CSS/Javascript (For 404 webpage page)\n\n## Installation\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/sunjay-dev/URL-Shortener-using-json-file/\n   cd URL-Shortener-using-json-file\n   npm install\n   npm start\n\n## Project Structure\n- controllers/: Contains the logic for handling requests and responses.\n- public/: Holds static files like 404 page.\n- data.json: The JSON file used to store short URLs and their corresponding original URLs.\n- routes/: Contains information about routes\n\n## Routes\n\nThe application provides the following routes:\n\n### GET `/shortid`\n- **Description**: Handles requests to the shortened URL and redirects to the original URL.\n- **Parameters**:\n  - `shortId`: The short ID of the URL to redirect.\n- **Response**:\n  - On success, redirects to the original URL.\n  - If the short ID does not exist, returns a 404 error.\n  \n### POST `/`\n- **Description**: Creates a new shortened URL.\n- **Request Body**:\n  - `url`: The original URL to be shortened.\n- **Response**:\n  - Returns a JSON object containing the shortened URL.\n\n### POST `/custom`\n- **Description**: Creates a new shortened URL with a custom alias.\n- **Request Body**:\n  - `url`: The original URL to be shortened.\n  - `custom`: The custom alias for the shortened URL.\n- **Response**:\n  - Returns a JSON object containing the shortened URL with the custom alias.\n  - If the custom alias is already in use, returns an 409 error message.\n\n### GET `/api/details?url=shortId`\n- **Description**: Provides details about shortened url.\n- **Parameters**:\n  - `shortId`: The short ID of the URL to retrieve.\n- **Response**:\n  - On success, returns a JSON object containing number of click, original url, and array of lastOpened times.\n  - If the short ID does not exist, returns a 404 error.\n\n\n\n\n## Contributing\nFeel free to submit issues or pull requests if you have suggestions for improvements.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunjay-dev%2Furl-shortener-using-json-file","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunjay-dev%2Furl-shortener-using-json-file","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunjay-dev%2Furl-shortener-using-json-file/lists"}