module
0.0.0-20241230120742-b78ad7274f66
Repository: https://github.com/jdaniecki/url-shortener.git
Documentation: pkg.go.dev
# README
url-shortener
URL shortener design and POC
TODO
- tools pattern & config
- blog posts
- API: versioning, healthz
- Code: configfile, sqldb
Usage
To shorten a URL, send a POST request to the /shorten
endpoint with
a JSON body containing the URL to be shortened:
curl -X POST http://localhost:8080/shorten \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com"}'
The response will contain the shortened URL:
{
"shortUrl":"http://localhost:8080/0"
}
To retrieve the original URL, send a GET request to the /{shortUrl}
endpoint:
curl http://localhost:8080/0
The response will contain redirect to the original URL.
Develop
Prerequisites
go
1.23+ installed. You can install it by following the instructions here.mage
installed. You can install it by following the instructions here.oapi-codegen
installed. You can install it by following the instructions here.golangci-lint
installed. You can install it by following the instructions here.
How to Build
To build the project, run the following command:
mage build
How to Run
To run the project, use:
mage run
How to Test
To execute tests, run:
mage test
# Packages
No description provided by the author