This project is a full-stack MERN (MongoDB, Express, React, Node.js) application demonstrating CRUD (Create, Read, Update, Delete) operations.
- Create: Add new records to the database
- Read: Display a list of records fetched from the database
- Update: Modify existing records
- Delete: Remove records from the database
- React: Used for building the user interface
- Axios: For making HTTP requests to the backend
- CSS: Styling of components
- Node.js: Runtime environment for JavaScript
- Express.js: Framework for building the RESTful API
- MongoDB: NoSQL database for storing application data
- Mongoose: MongoDB object modeling tool for Node.js
- Node.js installed on your system
- MongoDB installed and running
- Git installed
-
Clone the repository:
git clone <repository_url> cd mern-crud-application
-
Install dependencies for the frontend and backend:
# Install backend dependencies cd backend npm install # Install frontend dependencies cd ../frontend npm install
-
Create a
.env
file in thebackend
directory:PORT=5000 MONGO_URI=mongodb://localhost:27017/mern-crud
-
Start the MongoDB server:
mongod
-
Start the application:
- Backend:
cd backend npm start
- Frontend:
cd ../frontend npm start
- Backend:
-
Open your browser and navigate to
http://localhost:3000
.
mern-crud-application
├── backend
│ ├── models
│ │ └── recordModel.js
│ ├── routes
│ │ └── recordRoutes.js
│ ├── server.js
│ └── .env
├── frontend
│ ├── public
│ └── src
│ ├── components
│ │ ├── CreateRecord.js
│ │ ├── RecordList.js
│ │ ├── UpdateRecord.js
│ ├── App.js
│ └── index.js
└── README.md
Method | Endpoint | Description |
---|---|---|
GET | /api/records |
Fetch all records |
POST | /api/records |
Add a new record |
GET | /api/records/:id |
Fetch a single record |
PUT | /api/records/:id |
Update a record |
DELETE | /api/records/:id |
Delete a record |
- Fork the repository
- Create a feature branch:
git checkout -b feature-branch-name
- Commit your changes:
git commit -m "Your message here"
- Push your changes:
git push origin feature-branch-name
- Open a pull request
This project is licensed under the MIT License.