This API is designed for a gaming platform that enables users to register, place bets, participate in challenges and tournaments, and share achievements on social media.
- Node.js
- Express
- MongoDB with Mongoose
- TypeScript
- dotenv for environment variable management
- Clone the repository:
git clone https://github.com/yataknemogy/gaming-api-dev-bounty.git
- Navigate into the project directory:
cd gaming-api-dev-bounty - Install dependencies:
npm install
- Create a
.envfile in the root folder and add the following variables:PORT=4000 MONGO_URI=<your-mongodb-uri> JWT_SECRET=<your-jwt-secret>
-
Start the server:
npm run dev
-
Available Routes:
- POST
/api/users/register- Register a new user - GET
/api/users/:publicKey- Get user by public key - POST
/api/users/:publicKey/deposit- Deposit funds to user balance - GET
/api/users/top-users- Get top users by total bet amount
- POST
/api/bets- Create a new bet - POST
/api/bets/:betId/status- Update bet status (win/loss) - GET
/api/bets/user/:userId/statistics- Get bet statistics for a user
- POST
/api/challenges- Create a new challenge - POST
/api/challenges/:challengeId/join- Join a challenge - POST
/api/challenges/:challengeId/complete- Complete a challenge - GET
/api/challenges/public- Get public challenges
- POST
/api/tournaments- Create a new tournament - POST
/api/tournaments/:tournamentId/participants- Add participant to a tournament - POST
/api/tournaments/:tournamentId/advance- Advance to the next round - POST
/api/tournaments/:tournamentId/end- End the tournament
- POST
/api/social-share/generate- Generate social media content for achievements
- POST
-
Testing: Use a tool like Postman to send HTTP requests to the routes listed above.
src/controllers/: Route handlers for the API endpointsmodels/: Mongoose models for MongoDB collectionsservices/: Core business logic and database operationsroutes/: API route definitionsutils/: Utility functions, such as error handling and loggingconfig/: Database connection and collection initialization
This project is licensed under the MIT License.