Backend services for MyBrand project.
- Description
- Features
- Features
- Installation
- Usage
- Testing
- API Documentation
- API Endpoints
- API Documentation
- API Endpoints
- License
This repository contains the backend services for MyBrand, a project aimed at managing blogs, users, and their associated data. It provides RESTful APIs for communication with the frontend and handles authentication, database operations, and more.
- Authentication: Secure user authentication using JSON Web Tokens (JWT).
- Data Management: CRUD operations for blogs and users, powered by MongoDB with Mongoose.
- File Uploads: Multer middleware for handling file uploads.
- Email Verification: Verify user emails using Nodemailer.
- API Documentation: Swagger UI for easy API reference.
This repository contains the backend services for MyBrand, a project aimed at managing blogs, users, and their associated data. It provides RESTful APIs for communication with the frontend and handles authentication, database operations, and more.
- Authentication: Secure user authentication using JSON Web Tokens (JWT).
- Data Management: CRUD operations for blogs and users, powered by MongoDB with Mongoose.
- File Uploads: Multer middleware for handling file uploads.
- Email Verification: Verify user emails using Nodemailer.
- API Documentation: Swagger UI for easy API reference.
To run the backend locally, follow these steps:
-
Clone this repository:
git clone https://github.com/hbapte/MyBrand-Backend.git
-
Install dependencies:
npm install
-
To start the server in development mode, use:
npm run dev
-
For production, build the project first and then start the server:
npm run build npm start
API documentation is available using Swagger UI. You can access it https://my-brand-oxuh.onrender.com/api-docs/
-
To run tests, use:
npm run test
-
To run test with coverage summary:
npm run coverage
- Localhost Server: http://localhost:3000/api
- Cloud Server: https://my-brand-oxuh.onrender.com/api
NO | METHOD | ENDPOINT | STATUS | ACCESS | DESCRIPTION |
---|---|---|---|---|---|
1 | GET | / | 200 | Public | Welcome to the API |
2 | POST | /auth/register | 201 | Public | Register a new user |
3 | POST | /auth/login | 201 | Public | User login |
4 | POST | /blogs | 201 | Auth Token | Add a new blog |
5 | GET | /blogs | 200 | Public | Get all blogs |
6 | GET | /blogs/{id} | 200 | Public | Get a blog by ID |
7 | PUT | /blogs/{id} | 200 | Auth Token | Update a blog by ID |
8 | DELETE | /blogs/{id} | 200 | Auth Token | Delete a blog by ID |
9 | POST | /contact | 200 | Public | Add a new message |
10 | GET | /contact | 200 | Public | Get all messages |
11 | DELETE | /contact/{id} | 200 | Auth Token | Delete a message by ID |
This project is licensed under the MIT License.