Welcome to the CRUD API repository! This project demonstrates a basic CRUD (Create, Read, Update, Delete) API using Node.js, Express, and MongoDB. This API allows users to create, read, update, and delete resources stored in a MongoDB database.
- Create: Add new resources to the database.
- Read: Retrieve existing resources from the database.
- Update: Modify existing resources in the database.
- Delete: Remove resources from the database.
- Node.js: JavaScript runtime environment.
- Express: Web framework for Node.js.
- MongoDB: NoSQL database.
- Mongoose: ODM (Object Data Modeling) library for MongoDB and Node.js.
Ensure you have the following :
- Node.js - Install on your machine.
- MongoDB Atlas - Cloud service no need to install any software. Just visit the MongoDB website and follow the instructions.
-
Clone the repository:
git clone https://github.com/KartikLakhotiya/CRUD-API.git cd CRUD-API
-
Install dependencies in both frontend and backend folder:
npm install
-
Create a
.env
file in the root directory and add your MongoDB connection string:PORT=8080 MONGO_URI="your_mongo_atlas_connection_string"
-
Go into the backend directory:
cd backend npm run dev
-
Go into the frontend directory:
npm run dev
The API (Backend) will be running at http://localhost:8080
.
The Frontent will be running at http://localhost:5173
.
The API includes basic error handling for common issues such as:
- User not found
- Invalid credentials
- Server errors
Contributions are welcome! Please fork this repository and submit a pull request for any changes you'd like to make.
This project is licensed under the MIT License. See the LICENSE file for details.
For questions or support, please open an issue in this repository.
Thank you for using the CRUD API! Happy coding!