From 9d68dfc3ba61b222c01224703b644088b547108f Mon Sep 17 00:00:00 2001 From: strNophix Date: Sun, 28 Aug 2022 15:23:17 +0200 Subject: [PATCH] Updated README.md --- README.md | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index de56084..a21341c 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,39 @@ 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 ```bash # Shorten a URL -curl --header "Content-Type: application/json" \ - --request POST \ - --data '{"longUrl":"https://news.ycombinator.com"}' \ +curl -X POST -H "Content-Type: application/json" \ + -d '{"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 # Expand the URL curl -iL http://localhost:5111/{id} + +# Get information of a specific URL +curl -iL http://localhost:5111/api/v1/links/{id} ```