This is the backend for the Train Lighting Simulator. It simulates communication between the Central Train Computer (CTC) and the Remote Device (RD) for protocol-based lighting control.
- Serves protocol configuration JSON files to the frontend.
- Handles incoming requests for protocol commands and simulates responses.
- Configurable endpoints for multiple protocols (e.g., CIP, TRDP).
-
Prerequisites
- Node.js (v16 or higher)
- npm or yarn
-
Clone the Repository
git clone <repository-url> cd train-lighting-simulator/backend
-
Install Dependencies
npm install
-
Run the Server
npm start
The backend server will start at
http://localhost:5000
. -
API Endpoints
GET /protocol-configs/:protocol
: Serves protocol configuration JSON files.POST /api/send-message
: Simulates message exchange and provides responses.
-
Environment Variables Create a
.env
file in the backend directory for configuration:PORT=5000
backend/
protocol-configs/
CIP.json
TRDP.json
src/
routes/
server.js
This project is licensed under the OAMK License.