This is a RESTful API for managing a small business, built with Node.js, Express, and MongoDB.
- User authentication and authorization
- CRUD operations for businesses and products
- JWT-based authentication
- Middleware for protecting routes
- Global error handling
- Environment variables support
- Logging with log4js
- Unit tests with Jest and Supertest
- Clone the repository:
git clone https://github.com/Efrat6821/node-project.git
cd node-project- Install dependencies:
npm install- Create a
.envfile and add the following variables:
JWT_SECRET=br!mfc6^GFDSChgvHGF95$%^^&- Start the server:
node app.js- Run tests:
npm testPOST /user/signUp- Sign up a new userPOST user/signIn- Sign in an existing user
POST /business- Create a new business (Admin only)PUT /business/:id- Update an existing business (Admin only)GET /business- Get all business (Admin only)GET /business/:id- Get business By id(Admin only)
POST /service- Create a new service (Admin only)PUT /service/:id- Update an existing service (Admin only)GET /service- Get all servicesGET /service/:id- Get service by idDELETE /service/:id- Delete service by id(Admin only)
-
POST /meeting- Create a new meeting -
PUT /meeting/:id- Update an existing meeting (Admin only) -
GET /meeting- Get all meetings -
GET /meeting/:id- Get meeting by id -
DELETE /meeting/:id- Delete meeting by id (Admin only) -
GET /user- Get all users (Admin only)
This project is licensed under the MIT License.