The backend for TCrypto provides APIs to manage cryptocurrencies, events, and the leaderboard. It handles real-time updates for crypto prices and market events.
- Cryptocurrency Management: Fetch and update cryptocurrency data, including price history and volatility.
- Leaderboard: Manage player scores and rankings.
- Market Events: Simulate random events that affect market conditions.
- Database Integration: Uses MongoDB for storing data.
- RESTful API: Provides endpoints for frontend interaction.
- Clone the repository.
- Install dependencies:
npm install
- Set up the
.envfile with the following variables:ATLAS_URI=<your_mongodb_connection_string>
Starts the backend server on http://localhost:5000.
Change 'localhost' by your IP address in the server.js file.
- GET /api/users: Fetch leaderboard data.
- POST /api/users: Add or update a user score.
- GET /api/currencies: Fetch cryptocurrency data.
- GET /api/price-history: Fetch price history for cryptocurrencies.
- GET /api/events: Fetch random market events.
- Node.js: Backend runtime.
- Express.js: Web framework.
- MongoDB: Database for storing data.
- dotenv: Environment variable management.
Ensure the MongoDB connection string is correctly set in the .env file before deploying.
Based on an old repository