A simple Node.js API using Express and MongoDB to manage user data.
- Fetch User Data by Customer ID
- Fetch All Users Data
- Node.js
- Express.js
- MongoDB
- Mongoose
- Cors
project-root/
├── config/
│ └── database.js
├── controllers/
│ └── getUserData.js
├── models/
│ └── userData.js
├── routes/
│ └── dataRoutes.js
├── .env
├── index.js
└── README.md
- Node.js
- MongoDB
- npm
-
Clone the repo:
git clone https://github.com/yourusername/user-data-api.git cd user-data-api
-
Install dependencies:
npm install
-
Create a
.env
file with your configuration:PORT=3000 MONGO_URI=your_mongodb_connection_string
npm start
The server runs on http://localhost:3000
.
- POST
/user/data
- Fetch user data by customer ID. - GET
/user/all
- Fetch all users data.