This is a simple Express.js API that connects to a MongoDB database using Mongoose. The application provides a basic structure to manage a CRM system with routes for handling requests.
Ensure you have the following installed on your system:
-
Clone the repository:
git clone https://github.com/auri-gabriel/CRM cd CRM -
Install dependencies:
npm install
Ensure MongoDB is running locally
Start the Express server:
npm run startBy default, the server will run on http://localhost:4000/.
| Method | Route | Description |
|---|---|---|
| GET | / |
Running Message |
| GET | /contact |
Retrieve all contacts |
| POST | /contact |
Add a new contact |
| GET | /contact/:contactID |
Retrieve a contact by ID |
| PUT | /contact/:contactID |
Update a contact by ID |
| DELETE | /contact/:contactID |
Delete a contact by ID |
| Method | Route | Description |
|---|---|---|
| POST | /auth/register |
Register a new user |
| POST | /login |
Authenticate a user and return a JWT |
express- Web framework for Node.jsmongoose- ODM for MongoDBbody-parser- Middleware for parsing request bodiescors- Middleware for handling CORS requestsbcrypt- Library for hashing passwordsjsonwebtoken- Library for generating and verifying JWT tokens