From 226f821598fe60445a98c82795cc24655ff0fc76 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Tue, 10 Aug 2021 16:53:51 -0500 Subject: [PATCH] docs: included required header for API calls --- README.md | 37 ++++++++++++++++++++++--------------- docs/docker-compose.yml | 7 ++++++- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 7e0a152..36f4a06 100644 --- a/README.md +++ b/README.md @@ -49,24 +49,31 @@ Routes Minecraft client connections to backend servers based upon the requested # REST API -* `GET /routes` +* `GET /routes` (with `Accept: application/json`) + Retrieves the currently configured routes -* `POST /routes` - Registers a route given a JSON body structured like: -```json -{ - "serverAddress": "CLIENT REQUESTED SERVER ADDRESS", - "backend": "HOST:PORT" -} -``` -* `POST /defaultRoute` + +* `POST /routes` (with `Content-Type: application/json`) + + Registers a route given a JSON body structured like: + ```json + { + "serverAddress": "CLIENT REQUESTED SERVER ADDRESS", + "backend": "HOST:PORT" + } + ``` + +* `POST /defaultRoute` (with `Content-Type: application/json`) + Registers a default route to the given backend. JSON body is structured as: -```json -{ - "backend": "HOST:PORT" -} -``` + ```json + { + "backend": "HOST:PORT" + } + ``` + * `DELETE /routes/{serverAddress}` + Deletes an existing route for the given `serverAddress` # Docker Multi-Architecture Image diff --git a/docs/docker-compose.yml b/docs/docker-compose.yml index 90de42d..d57675b 100644 --- a/docs/docker-compose.yml +++ b/docs/docker-compose.yml @@ -11,8 +11,13 @@ services: EULA: "TRUE" TYPE: FORGE router: - image: itzg/mc-router + image: ${MC_ROUTER_IMAGE:-itzg/mc-router} + environment: + # enable API + API_BINDING: ":25564" ports: - 25565:25565 + # bind the API port to only loopback to avoid external exposure + - 127.0.0.1:25564:25564 command: --mapping=vanilla.example.com=vanilla:25565,forge.example.com=forge:25565