From 2605a58cfc2822a99f3cc57ebe84e685b55e1769 Mon Sep 17 00:00:00 2001 From: Samuel Cattini-Schultz Date: Wed, 17 Apr 2024 21:57:25 +1000 Subject: [PATCH] Add usages instructions to README --- README.md | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 65 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d63e3b2..bcccdb3 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,74 @@ Difficalcy is an osu! difficulty and performance calculator REST API. -## Usage +## Basic usage -TODO: docker image usage instructions +1. Run the container + ```sh + docker run -p 5000:80 ghcr.io/syriiin/difficalcy-osu:latest + ``` +1. Query the API + + ```sh + curl "localhost:5000/api/calculator/info" + ``` + + ```json + { + "rulesetName": "osu!", + "calculatorName": "Official osu!", + "calculatorPackage": "osu.Game.Rulesets.Osu", + "calculatorVersion": "2023.1114.1.0", + "calculatorUrl": "https://nuget.org/packages/ppy.osu.Game.Rulesets.Osu/2023.1114.1.0" + } + ``` + + ```sh + curl "localhost:5000/api/calculator/calculation?BeatmapId=658127" + ``` + + ```json + { + "difficulty": { + "aim": 3.471503344019442, + "speed": 3.4738667283055444, + "flashlight": 4.58994045567377, + "total": 7.255439646986892 + }, + "performance": { + "aim": 220.83646290283872, + "speed": 231.26239294786578, + "accuracy": 142.3199671239901, + "flashlight": 0, + "total": 614.5217398659557 + } + } + ``` + +## Example docker compose setup + +```yaml +services: + difficalcy-osu: + image: ghcr.io/syriiin/difficalcy-osu:latest + environment: + - REDIS_CONFIGURATION=cache:6379 + ports: + - "5000:80" + volumes: + - beatmaps + depends_on: + - cache + + cache: + image: redis:latest + + volumes: + beatmaps: +``` ## Development Setup ```sh -$ make start-dev +make start-dev ```