doc: update README

This commit is contained in:
wancat committed 2023-08-08 20:38:27 +08:00
1 parent 6f368f761e
commit 41a090ce73
1 file changed
+53 -17
+53 -17
View File
@@ -17,7 +17,8 @@ yarn install
## Create database ## Create database
``` ```
docker compose up -d docker compose pull
docker compose up -d db
``` ```
## Server ## Server
@@ -25,10 +26,23 @@ docker compose up -d
Source: `server/` Source: `server/`
``` ```
yarn server docker compose -f docker-compose.build.yml pull
docker compose up -d
# Open http://localhost:3000 # 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 ## App
Source: `app/` Source: `app/`
@@ -38,24 +52,46 @@ yarn app
# Open http://localhost:5173/ # Open http://localhost:5173/
``` ```
## Swagger
```
docker compose up -d swagger
```
Open http://localhost:8080 to open Swagger
## CLI terminal client ## CLI terminal client
Open server first, then create a session by `POST /api/v1/sessions` ```
yarn cli
Usage: client [options] [command]
```bash Options:
curl -X 'POST' \ -s, --session <string> Session ID
'http://localhost:3000/api/v1/sessions' \ -c, --create Create a new session
-H 'accept: application/json' \ -h, --host <string> Server host (default: "http://localhost:3000")
-H 'Content-Type: application/json' \ --help display help for command
-d '{
"quest_id": "helloworld" Commands:
}' list List all sessions
``` ```
Then use the `_id` field in response connet to recent session:
``` yarn cli
yarn cli [_id]
# example connect to new session:
yarn cli 64be226a39c0043cd1cdf7c2
``` 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