Skip to content

guiaramos/go-url-shortener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

URL Shortener

This is a simple URL shortener microservice in GO, you can use Redis or MongoDB

Settings

Redis

Mac

export URL_DB=redis
export REDIS_URL=redis://localhost:6379

Win

set URL_DB=redis
set REDIS_URL=redis://localhost:6379

MongoDB

Mac

export URL_DB=mongo
export MONGO_URL=mongodb://root:example@localhost:27017/shortener?authSource=admin
export MONGO_DB=shortener
export MONGO_TIMEOUT=30

Win

set URL_DB=mongo
set MONGO_URL=mongodb://root:example@localhost:27017/shortener?authSource=admin
set MONGO_DB=shortener
set MONGO_TIMEOUT=30

Run

cd cmd/cli
go run main.go

Create URL

POST /

curl --location --request POST 'http://localhost:8000' \
--header 'Content-Type: application/json' \
--data-raw '{
    "url": "https://github.com/guiaramos/go-url-shortener"
}'

User the URL

curl --location --request GET 'http://localhost:8000/5emxNyBMR'

About

GO Hexagonal Microservice

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages