This is a simple example demonstrating CRUD (Create, Read, Update, Delete) operations using the MERN stack. In this example, we'll build a basic application to manage user data.
Before running this application, ensure you have the following installed:
- Node.js and npm
- MongoDB
-
Clone this repository:
git clone <repository_url>
-
Navigate to the project directory:
cd crud-operation -
Install server dependencies:
cd backend npm install -
Install client dependencies:
cd ../frontend npm install
-
Start the server:
cd ../backend npm run dev -
Start the client:
cd ../frontend npm run dev -
Open your browser and go to
http://localhost:5555to view the application.
- Description: Get all employee
- Response: Array of user objects
- Description: Get a single user by ID
- Parameters:
id: User ID
- Response: User object
- Description: Create a new user
- Request Body: User object (JSON)
- Response: Newly created user object
- Description: Update an existing user
- Parameters:
id: User ID
- Request Body: Updated user object (JSON)
- Response: Updated user object
- Description: Delete a user by ID
- Parameters:
id: User ID
- Response: Success message
The frontend is built with React.js and styled with CSS. It provides a simple user interface to perform CRUD operations on user data.
The backend is built with Node.js and Express.js. It provides RESTful APIs to interact with the MongoDB database.
This application uses MongoDB as its database to store user data. Make sure MongoDB is running locally on your machine.
Contributions are welcome! Feel free to submit a pull request or open an issue if you find any bugs or want to suggest improvements.
This project is licensed under the MIT License - see the LICENSE file for details.