- Node.js with Express.js for the backend, providing a robust framework for building efficient and scalable server-side applications.
- Mongoose for MongoDB interaction, facilitating object data modeling and database interaction in an asynchronous environment.
- Passport.js for authentication and JWT (JSON Web Tokens) handling, offering a flexible and modular approach to handling user authentication and secure token generation.
- Nodemailer for handling email operations, crucial for features like sending verification emails during user registration. This adds a layer of security and user verification to the application.
- CORS (Cross-Origin Resource Sharing) enabled, ensuring the API can securely handle requests from different domain origins.
- Dotenv for managing environment variables, allowing easy configuration of the application in different environments without code changes.
- Docker, with a custom Dockerfile created for the application, enabling easy deployment and environment consistency by containerizing the application. This facilitates smoother development, testing, and production workflows.
To run the project locally, follow these steps:
- Clone the repository to your device.
- Install dependencies using npm install.
- Create a .env file in the main project directory and configure environment variables (PORT, DB_HOST, SECRET, SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASSWORD, BACKEND_URL, FRONTEND_URL).
- Start the local server using npm start.
Once the server is running, the API is available at http://localhost:[PORT]/api/. Available endpoints:
-
POST /api/users/signup - registers a new user.
-
GET /api/users/verify/:verificationToken - verifies a user's email.
-
POST /api/users/login - logs in a user.
- PATCH /api/users - update user data
- GET /api/users/logout - logs out a user.
- GET /api/users/current - retrieves data of the currently logged-in user.
- PATCH /api/users/avatars - updates a user's avatar.
-
POST
/api/payment/donation
body({amount*, email})
*amount in grosze is required, email can be skipped. Gets a link leading to p24 donation -
POST
/api/payment/participate
body({amount*, participant*})
*amount in grosze is required, participant required ({ km_, shirt*, shirtGender*, raceID }). Gets a link leading to p24 payment to register participant.
- GET api/race - get all participants list from chosen race