This is a backend system for the "Gold Rush" in-game event, which includes player authentication, event management, score reporting, leaderboards, bucketing logic, scheduling, and rewards distribution.
-
Clone the repository
git clone https://github.com/yourusername/gold-rush-backend.git cd gold-rush-backend -
Install dependencies
npm install
-
Create a
.envfile in the root of your project directory and add the following environment variables:MONGODB_URI=mongodb://localhost:27017/goldrush JWT_SECRET=your_jwt_secret PORT=3000 -
Start the server
npm start
POST /api/auth/register- Register a new userPOST /api/auth/login- Login an existing user
GET /api/event- Get the current event state
POST /api/report- Report the amount of gold collected
GET /api/leaderboard- Get the leaderboard for the current bucket
POST /api/claim- Claim rewards for the completed event
To run tests, use the following command:
npm testThis project is licensed under the MIT License - see the LICENSE file for details.