Skip to content

Latest commit

 

History

History
33 lines (21 loc) · 684 Bytes

README.md

File metadata and controls

33 lines (21 loc) · 684 Bytes

URL Shortener

This is a URL shortener app based on GoLang. It exposes APIs to generate short urls. All urls get stored in Memory.

SetUp:

  1. Clone the repositroy.
  2. Run go mod download to download all the dependency modules.
  3. Run go run main.go to run the server
  4. Server will start on 8001 port

APIs

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.