A URL shortener written in Go.
- MongoDB
- Redis
- JSON
- MessagePack
- Start Mongo and Redis servers
docker-compose up- For Mongo add the
redirectscollection - Mongo Express is accessible at
http://localhost:8081
- Copy
sample.envto.envand update values- Set
DB_TYPEtomongoorredis
- Set
- Start the application
go run main.go- The application is accessible at
http://localhost:8080
A health check endpoint that displays a message if the server is running.
Creates a new redirect and returns the code.
{
"url": "http:/example.com"
}{
"code": "Rz5x645Mg",
"url": "https://example.com",
"created_at": 1602164689
}Redirects you to the URL for the specified code.