A RESTful API application built with Node.js, Express, and MongoDB that implements CRUD (Create, Read, Update, Delete) operations for managing products.
- Node.js
- Express.js
- MongoDB with Mongoose
- dotenv for environment variables
Before running this project, make sure you have:
- Node.js installed
- MongoDB installed and running
- Git (optional, for cloning)
- Clone the repository:
git clone https://github.com/SenithVijayantha/simple-crud-app.git
- Navigate to the project directory:
cd simple-crud-app
- Install dependencies:
npm install
- Create a
.env
file in the root directory with the following variables:
PORT=your_port_number
MONGO_URI=your_mongodb_connection_string
To start the development server with nodemon:
npm run dev
The API provides the following endpoints for managing products:
GET /api/products
- Get all productsGET /api/products/:id
- Get a single product by IDPOST /api/products
- Create a new productPUT /api/products/:id
- Update a productDELETE /api/products/:id
- Delete a product
├── controllers/
│ └── productControllers.js
├── models/
│ └── Product.js
├── routes/
│ └── productRoutes.js
├── server.js
├── package.json
└── README.md
This project is licensed under the ISC License.
SenithVijayantha
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request