A 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.
- Generates an 8-character hash code for long URLs.
 - Retrieves the original URL using the short code.
 - Redirects to the original webpage using the short code.
 
Accepts a long URL in JSON format and returns an 8-character hash code as the shortened URL.
POST /shrink| Parameter | Type | Description | 
|---|---|---|
longUrl | 
string | 
Required. The long URL to be shortened. | 
Request :
{  
  "longUrl": "https://example.com/long-url"  
}Response :
{  
  "shortCode": "example123"  
}  Takes an 8-character hash code as a path parameter and returns the corresponding long URL.
GET /url/:code| Parameter | Type | Description | 
|---|---|---|
url | 
string | 
Required. 8-character hash code of the shortened URL. | 
Response :
{  
  "longUrl": "https://example.com/long-url"  
}Redirects to the original long URL corresponding to the provided 8-character hash code.
GET /visit/:code| Parameter | Type | Description | 
|---|---|---|
code | 
string | 
Required. The 8-character hash code of the shortened URL. | 
git clone https://github.com/nirmit27/link-shrink.gitcd link-shrinknpm installnode index.jsThe API will be available at http://localhost:3000.