Skip to content

jiaqi-yin/go-url-shortener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Golang URL Shortener

This application provides the service to generate short links of original long URLs and can redirect to the original URL from the short version.

Get Started

Build and Run

Run docker-compose up --build

Create a short link

Request:

curl -X POST http://localhost:8080/api/shorten -d '{"url":"https://www.google.com"}'
Response: 

{"shortlink":"4c94"}

Redirect from short links

Request:

curl -sL -o /dev/null -D - http://localhost:8080/4c94
Response:

HTTP/1.1 307 Temporary Redirect
Location: https://www.google.com
...
HTTP/2 200
...

About

This application provides the service to generate short links of original long URLs and can redirect to the original URL from the short version.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published