From 41a090ce7319bf413f192a771a76cbdc59f22796 Mon Sep 17 00:00:00 2001 From: wancat Date: Tue, 8 Aug 2023 18:17:43 +0800 Subject: [PATCH] doc: update README --- README.md | 70 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 53 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 2b70dd9..122d011 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,8 @@ yarn install ## Create database ``` -docker compose up -d +docker compose pull +docker compose up -d db ``` ## Server @@ -25,10 +26,23 @@ docker compose up -d Source: `server/` ``` -yarn server +docker compose -f docker-compose.build.yml pull +docker compose up -d # Open http://localhost:3000 ``` +### Build images + + docker compose build + docker compose push + +Game images: + +``` +docker compose -f docker-compose.build.yml build +docker compose -f docker-compose.build.yml push +``` + ## App Source: `app/` @@ -38,24 +52,46 @@ yarn app # Open http://localhost:5173/ ``` +## Swagger + +``` +docker compose up -d swagger +``` + +Open http://localhost:8080 to open Swagger + ## CLI terminal client -Open server first, then create a session by `POST /api/v1/sessions` +``` +yarn cli +Usage: client [options] [command] -```bash -curl -X 'POST' \ - 'http://localhost:3000/api/v1/sessions' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "quest_id": "helloworld" -}' +Options: + -s, --session Session ID + -c, --create Create a new session + -h, --host Server host (default: "http://localhost:3000") + --help display help for command + +Commands: + list List all sessions ``` -Then use the `_id` field in response +connet to recent session: -``` -yarn cli [_id] -# example -yarn cli 64be226a39c0043cd1cdf7c2 -``` + yarn cli + +connect to new session: + + yarn cli -c + +connect to specific session: + + yarn cli -s 64d0de0367459c13004bc83f + +connect to other host: + + yarn cli -h https://example.com + +list sessions: + + yarn cli list