Your URL Shortening Solution.
The site is live on:
- Backend: https://go-trim.tenzing121.com.np/
- Frontend: https://url-shortener-next-teal.vercel.app/
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
What things you need to install the software and how to install them :
-
Clone the git repository
git clone https://github.com/TenzingT-Lama2001/URL-Shortener.git
-
Go into the project directory
cd URL-Shortener/
-
Install dependencies
go mod tidy
-
Copy .env.example to .env
DOMAIN = "your-backend-url"
-
Run the program
go run main.go
-
Run the test
go test -v ./...
Accepts a JSON payload with a long URL and returns a short URL.
- Method:
POST
- Path:
/shorten
- Body:
longURL
(string): The long URL to be shortened. - Headers:
Content-Type: application/json
{
"longURL": "https://github.com/TenzingT-Lama2001/URL-Shortener"
}
Redirects users to the original long URL based on the short code provided.
- Method:
GET
- Path:
/{shortCode}
{
"shortURL": "http://localhost:3000/cCZAGC"
}