Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shamikaredkar/mongodb-express-nodejs-learning
This project is a simple backend API built with Node.js, Express, and MongoDB. It was created as a learning exercise to understand the fundamentals of backend development, including setting up an Express server, connecting to a MongoDB database, and performing CRUD (Create, Read, Update, Delete) operations.
https://github.com/shamikaredkar/mongodb-express-nodejs-learning
api api-rest express express-js express-middleware expressjs mongodb mongodb-atlas mongodb-database mongoose node-js nodejs nodemon
Last synced: about 1 month ago
JSON representation
This project is a simple backend API built with Node.js, Express, and MongoDB. It was created as a learning exercise to understand the fundamentals of backend development, including setting up an Express server, connecting to a MongoDB database, and performing CRUD (Create, Read, Update, Delete) operations.
- Host: GitHub
- URL: https://github.com/shamikaredkar/mongodb-express-nodejs-learning
- Owner: shamikaredkar
- Created: 2024-07-22T00:04:29.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-07-22T00:20:48.000Z (4 months ago)
- Last Synced: 2024-10-10T05:40:30.946Z (about 1 month ago)
- Topics: api, api-rest, express, express-js, express-middleware, expressjs, mongodb, mongodb-atlas, mongodb-database, mongoose, node-js, nodejs, nodemon
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Backend API
## About:
This project is a simple backend API built with Node.js, Express, and MongoDB. It was created as a learning exercise to understand the fundamentals of backend development, including setting up an Express server, connecting to a MongoDB database, and performing CRUD (Create, Read, Update, Delete) operations.
## Features:
### CRUD Operations
- **Create Product:** Add new products to the database.
- **Read Products:** Retrieve details of all products or a specific product by ID.
- **Update Product:** Modify existing product details.
- **Delete Product:** Remove products from the database.### Database Connectivity
- **MongoDB Integration:** Uses MongoDB for data storage, providing a flexible and scalable NoSQL database solution.
- **Mongoose ORM:** Simplifies interactions with MongoDB, enabling easy schema definition and validation.### Middleware
- **JSON Parsing:** Automatically parses incoming JSON requests.
- **URL Encoded Data:** Supports URL-encoded data, allowing form submissions.## Built With
- ![Node.js][Node.js]
- ![Express][Express]
- ![MongoDB][MongoDB]## Detailed explanation
#### `index.js`
- This is the entry point of the application.
- It sets up the Express server, connects to the MongoDB database, and defines the middleware for parsing JSON and URL-encoded data.
- It also imports and uses the routes described in `product.route.js`.#### `product.controller.js`
- This file contains the logic for handling product-related requests.
- It defines functions for getting all products, getting a product by ID, creating a new product, updating an existing product, and deleting a product.#### `product.route.js`
- This file defines the API routes for product management.
- It imports the controller functions and maps them to the corresponding HTTP methods and routes.#### `product.model.js`
- This file defines the Mongoose schema and model for products.
- It specifies the structure of the product documents in the MongoDB database.## Project Directory Structure
```plaintext
MEN-STACK/
│
├── controller/
│ └── product.controller.js
│
├── models/
│ └── product.model.js
│
├── node_modules/
│
├── routes/
│ └── product.route.js
│
├── .gitignore
├── index.js
├── package-lock.json
├── package.json
```[Node.js]: https://img.shields.io/badge/Node.js-339933?style=for-the-badge&logo=nodedotjs&logoColor=white
[Express]: https://img.shields.io/badge/Express-000000?style=for-the-badge&logo=express&logoColor=white
[MongoDB]: https://img.shields.io/badge/MongoDB-47A248?style=for-the-badge&logo=mongodb&logoColor=white