A Node.js + Express backend with MongoDB for CRUD operations on users.
- Create: Add new users with name and email
- Read: Get all users or a specific user by ID
- Update: Modify existing user details
- Delete: Remove users from the database
- Node.js
- Express.js
- MongoDB with Mongoose
- HTML/CSS/JavaScript for frontend interface
- Clone the repository
- Install dependencies:
npm install - Set up MongoDB (local or cloud)
- Configure environment variables in
.env - Start the server:
npm run dev
GET /api/users- Get all usersPOST /api/users- Create a new userGET /api/users/:id- Get a user by IDPUT /api/users/:id- Update a userDELETE /api/users/:id- Delete a user
- Start the server
- Open
http://localhost:5000/in your browser for the web interface - Or use tools like Postman to test the API endpoints
Import the collection or manually test the endpoints with JSON payloads.
Example POST request:
{
"name": "John Doe",
"email": "john@example.com"
}