Create an advanced Rest CRUD API For Node JS with Express and MongoDB
Hello everyone
In this article, we're going to show how to build an advanced CRUD API for Node JS.
What Technologies and Architecture we'll use -
- NODE JS
- Express JS
- Mongo DB
- Mongoose Object Model
- Repository Pattern
- MVC Pattern
- Schema Validation
- Input Request validation
- and Many more standard
What features included -
- API For - All Todos List
- API For - Single Todos Get
- API For - Post New Todo
- API For - Put API - Edit Todo
- API For - Delete API - Delete Todo
- API For - Delete All API
Step By Step How to Make:
It's coming soon [Please check the Below process How to Run for now]
How to Run:
Install NPM
npm i
Create .env
file by copying .env.example
MONGODB_DEFAULT_DB=
MONGODB_CLUSTER=
MONGODB_USERNAME=
MONGODB_PASSWORD=
Run Project with nodemon setup (Watch any changes)
npm run dev
Postman API Link
https://www.getpostman.com/collections/f96bafc60eb5fa7a7784
Live Web API Demo Links at a glance
- Base URL - https://node-cruds-api.herokuapp.com/
- All Todos - https://node-cruds-api.herokuapp.com/todos
- Single Todos - https://node-cruds-api.herokuapp.com/todos/60fb121b55e09ca6e646e93e
- Post API - https://node-cruds-api.herokuapp.com/todos [Body dataset Read below]
- Put API - https://node-cruds-api.herokuapp.com/todos/60fb121b55e09ca6e646e93e [Body dataset Read below]
- Delete API - https://node-cruds-api.herokuapp.com/todos/60fb121b55e09ca6e646e93e [Body dataset Read below]
- Delete All API - https://node-cruds-api.herokuapp.com/todos [Body dataset Read below]
Todo List
URL: http://localhost:3000/todos Method: GET
[
{
"_id": "60fadbf0fb1e9926fb60c07d",
"title": "First todo",
"status": "Done"
},
{
"_id": "60fadfc796dbc5f55f4adbe0",
"title": "Another task",
"status": "Pending"
}
]
Todo Detail:
Endpoint: http://localhost:3000/todos/60fadbf0fb1e9926fb60c07d
Method: GET
{
"_id": "60fadbf0fb1e9926fb60c07d",
"title": "First todo",
"status": "Done"
}
Todo Create:
Endpoint: http://localhost:3000/todos
Method: POST
{
"title": "Demo Todo 1",
"status": "Pending"
}
{
"_id": "60fb0e8bd8cd4f9cb52910a0",
"title": "Demo Todo 1",
"status": "Pending",
"createdAt": "2021-07-23T18:46:35.288Z",
"updatedAt": "2021-07-23T18:46:35.288Z",
"__v": 0
}
Todo Update:
Endpoint: http://localhost:3000/todos/60fadbf0fb1e9926fb60c07d
Method: PUT
{
"title": "Demo Todo 1 Updated",
"status": "Done"
}
{
"message": "Todo has been updated successfully !",
"data": {
"_id": "60fadbf0fb1e9926fb60c07d",
"title": "Demo Todo 1 Updated",
"createdAt": "2021-07-23T17:54:04.823Z",
"updatedAt": "2021-07-23T18:54:12.279Z",
"__v": 0,
"status": "Done"
}
}
Todo Delete:
Endpoint: http://localhost:3000/todos/60fadbf0fb1e9926fb60c07d
Method: DELETE
{
"message": "Todo has been deleted successfully !",
"data": {
"_id": "60fb139e55e09ca6e646e947",
"title": "Test Todo",
"status": "Done",
"createdAt": "2021-07-23T19:08:14.137Z",
"updatedAt": "2021-07-23T19:08:14.137Z",
"__v": 0
}
}
Github Repository of Node JS CRUD API Project
https://github.com/ManiruzzamanAkash/Node-Advanced-CRUD-API
PHP If-else-elseif and Switch-case
PHP String Functions - All necessary String functions in PHP to manage strings better.
Popular Tutorials
Popular Tutorials
Categories
-
Artificial Intelligence (AI)
11
-
Bash Scripting
1
-
Bootstrap CSS
0
-
C Programming
14
-
C#
0
-
ChatGPT
1
-
Code Editor
2
-
Computer Engineering
3
-
CSS
28
-
Data Structure and Algorithm
18
-
Design Pattern in PHP
2
-
Design Patterns - Clean Code
1
-
E-Book
1
-
Git Commands
1
-
HTML
19
-
Interview Prepration
2
-
Java Programming
0
-
JavaScript
12
-
Laravel PHP Framework
37
-
Mysql
1
-
Node JS
1
-
Online Business
0
-
PHP
28
-
Programming
8
-
Python
12
-
React Js
19
-
React Native
1
-
Redux
2
-
Rust Programming
15
-
SEO - Search Engine Optimization
1
-
Tailwind CSS
1
-
Typescript
10
-
Uncategorized
0
-
Vue JS
1
-
Windows Operating system
1
-
Woocommerce
1
-
WordPress Development
2
Tags
- Artificial Intelligence (AI)
- Bash Scripting
- Business
- C
- C Programming
- C-sharp programming
- C++
- Code Editor
- Computer Engineering
- CSS
- Data Structure and Algorithm
- Database
- Design pattern
- Express JS
- git
- Git Commands
- github
- HTML
- Java
- JavaScript
- Laravel
- Mathematics
- MongoDB
- Mysql
- Node JS
- PHP
- Programming
- Python
- React Js
- Redux
- Rust Programming Language
- SEO
- TypeScript
- Vue JS
- Windows terminal
- Woocommerce
- WordPress
- WordPress Plugin Development