This is a URL shortener app based on GoLang. It exposes APIs to generate short urls. All urls get stored in Memory.
- Clone the repositroy.
- Run
go mod download
to download all the dependency modules. - Run
go run main.go
to run the server - Server will start on
8001
port
1. Generate Short URL
URL: http://localhost:8001/short-url
Method: POST
Request Body:
{"url": "<original_url>"}
Response:
{"success": true, "shortUrl": "<short_url>"}
2. Open URL
Open URL http://localhost:8001/u/<short_url>
in browser. It will redirect to the original url if short url is valid.