This repository contains the backend API for a pet adoption platform. The API allows users to log in, create new users, index pets from third-party APIs into the database, update pet statuses, and search for pets based on various parameters.
Make sure you have the following software installed on your machine:
-
Clone the repository:
git clone https://github.com/DouglasVolcato/pet-adoption-backend.git
-
Navigate to the project directory:
cd pet-adoption-backend -
Install dependencies:
npm install
-
Fulfill the .env variables
Run the following command to start the application:
npm startThe API will be accessible at http://localhost:3000.
To run tests, use the following command:
npm testThis will execute unit and integration tests.
- Endpoint:
/login - Method:
POST - Description: User login
- Request Body:
{ "email": "user@example.com", "password": "password123" } - Responses:
200: Successful login400: Bad request500: Internal server error
- Endpoint:
/user - Method:
POST - Description: Create user
- Request Body:
{ "name": "John Doe", "email": "john.doe@example.com", "password": "password123" } - Responses:
200: Successful creation400: Bad request500: Internal server error
- Endpoint:
/pet - Method:
POST - Description: Index pets into the database
- Security: Bearer Token
- Responses:
200: Successful request401: Unauthorized500: Internal server error
- Endpoint:
/pet - Method:
PUT - Description: Update pet status
- Security: Bearer Token
- Request Body:
{ "petId": "12345", "newStatus": "free" } - Responses:
200: Successful update400: Bad request401: Unauthorized500: Internal server error
- Endpoint:
/pet - Method:
GET - Description: Get pets
- Parameters:
limit(number)offset(number)term(string)category(string, "cats" or "dogs")status(string, "free" or "adopted")createdAt(string)
- Responses:
200: Successful request400: Bad request500: Internal server error
- axios
- bcrypt
- body-parser
- cors
- dotenv
- email-validator
- express
- jsonwebtoken
- mongoose
- swagger-ui-express
- uuid
This project is licensed under the ISC License - see the LICENSE.md file for details.