This repository contains a Node.js mod example for integration with MyDU servers. It provides an API server and mod registration functionality for custom mod communication.
- Node.js (version 14 or higher)
- Docker and Docker Compose (preffered, for containerized deployment)
- Environment variables configured in a
.envfile (see details below)
git clone https://github.com/jimmybutzen/mydu-nodejs-mod-example.git
cd mydu-nodejs-mod-exampleCreate a .env file in the project root with the following environment variables:
ORLEANS_URL=<orleans_server_url>
WEBHOOK_BASE_URL=<webhook_base_url>
WEBHOOK_PORT=<webhook_port>Replace <orleans_server_url>, <webhook_base_url>, and <webhook_port> with appropriate values for your setup.
npm installTo start the server, run:
node index.jsThe API server will start and listen on the port defined in WEBHOOK_PORT.
If you prefer a containerized setup, use the Docker files provided.
docker-compose up --buildThis command builds and starts the Docker container, setting up your environment according to docker-compose.yml and Dockerfile.
- Mod Registration: The mod will automatically register itself with the MyDU server using the
registerModfunction. - API Endpoints:
/getmodinfo: Provides mod information./action/: Triggers an action from the game to the mod.
- index.js: Entry point of the server, initializes the API server and registers the mod.
- api.js: Contains the API logic for mod registration, sending requests, and handling actions.
- Connection Issues: Ensure that
ORLEANS_URLandWEBHOOK_PORTin the.envfile are correctly configured. - Docker Setup: If you encounter issues with Docker, make sure Docker and Docker Compose are installed and properly configured.