Link Shortener with Hexagonal Architecture
export $(grep -v '^#' ./.env | xargs -d '\n')
make migrate-up
make build
Run the project on ip
and port
that are sets in .env
file:
make run
or
./bin/go-linke-shotener
Request:
curl -X POST http://0.0.0.0:8000/api/links --data '{"url": "https://google.com/"}'
Response:
{
"id": "ZDI3Z",
"original": "https://google.com/",
"created_at": "2023-01-30 00:00:00"
}
Request:
curl -X GET http://0.0.0.0:8000/api/links
Response:
[
{
"id": "ZDI3Z",
"original": "https://google.com/",
"created_at": "2023-01-30 00:00:00"
}
]
Request:
curl -X GET http://0.0.0.0:8000/api/links/{id}
Response:
{
"id": "ZDI3Z",
"original": "https://google.com/",
"created_at": "2023-01-30 00:00:00"
}
Request:
curl -X POST http://0.0.0.0:8000/api/health
curl -i -X GET http://0.0.0.0:8000/{id}