ApiValidator is a project aimed at developing a RESTful API with Express.js, focusing on thorough validation of incoming data for various routes. The project emphasizes the creation of comprehensive unit tests using Jest to ensure effective validation and proper functioning of each part of the API.
- Create, Read, Update, and Delete (CRUD) operations for products
- Thorough validation of incoming data for each operation
- Detailed unit tests using Jest to validate the API endpoints
- Node.js
- Express.js
- MongoDB (with Mongoose for ODM)
- Jest
- Joi
- Clone the repository:
git clone https://github.com/YNS-JNS/ApiValidator.git
- Navigate to the project directory:
cd ApiValidator
- Install dependencies:
npm install
- Set up environment variables:
Create a .env
file in the root directory and add the following variables:
MONGODB_URI=<your-mongodb-uri>
PORT=<your-port>
USERNAME_MONGODB_ATLAS=<your-username>
PASSWORD_MONGODB_ATLAS=<your-password>
- Once the server is running, you can use tools like Postman or any REST client to interact with the API endpoints.
- The API provides endpoints for creating, reading, updating, and deleting products. Ensure to provide valid data according to the specified validation rules.
This document provides a brief overview of the API routes available for interacting with products in the ApiValidator project.
Unit tests are implemented using Jest. To run the tests, use the following command:
npm test
This API was created โจ by :
- Node.js Documentation: https://nodejs.org/docs/latest/api/
If you find issues or want to contribute, follow these steps:
- Fork the project.
- Create a branch for your feature:
git checkout -b feature/NewFeature
. - Commit your changes:
git commit -m "Add New Feature"
. - Push to the branch:
git push origin feature/NewFeature
. - Open a pull request.