Updated README.md

This commit is contained in:
strNophix 2022-08-28 15:23:17 +02:00
parent 0110d6994b
commit 9d68dfc3ba

View File

@ -2,14 +2,39 @@
A URL shortener that generates links even shorter than 5'11. A URL shortener that generates links even shorter than 5'11.
## Requirements
- ScyllaDB
- Docker
- Prometheus*
*: Optional
## Run
Update the config at `etc/fivefeeteleven-api.yaml`.
```sh
# Docker
docker run -it $(docker build -q .)
# Compile
make build && ./5feet11
```
## Usage ## Usage
```bash ```bash
# Shorten a URL # Shorten a URL
curl --header "Content-Type: application/json" \ curl -X POST -H "Content-Type: application/json" \
--request POST \ -d '{"longUrl":"https://news.ycombinator.com"}' \
--data '{"longUrl":"https://news.ycombinator.com"}' \ http://localhost:5111/api/v1/links
# Shorten a URL that expires after N seconds
curl -X POST -H "Content-Type: application/json" \
-d '{"longUrl":"https://news.ycombinator.com", "expiresAfter": 30}' \
http://localhost:5111/api/v1/links http://localhost:5111/api/v1/links
# Expand the URL # Expand the URL
curl -iL http://localhost:5111/{id} curl -iL http://localhost:5111/{id}
# Get information of a specific URL
curl -iL http://localhost:5111/api/v1/links/{id}
``` ```