Node.js RestAPIs Express Mysql Example - Sequelize ORM Queries [Debug Mode]

preview_player
Показать описание
Node js Express Mysql Example - Sequelize ORM Queries [Debug Mode]

#nodejs #express #mysql #sequelizequery
#nodejsexamples #nodejsexpressexample #nodejsmysqlsequelize

In the tutorial, I will introduce step by step how to create a Nodejs RestAPIs and MySQL database with a full-stack technologies: Express RestAPI Framework (Cors + Body-Parse) + Sequelize ORM + MySQL.

- To do CRUD operations with MySQL database, We use Sequelize ORM.

We will define 8 RestAPIs with POST/GET/PUT/DELETE methods for posting, fetching, updating, removing, pagination, filtering and sorting data from MySQL database:

– For normally requests with POST/GET/PUT/DELETE methods, we create a first GROUP with 5 RestAPIs:

1. a POST RestAPI /api/customers/create will handle the submit data from client to save in MySQL database
2. a GET RestAPI /api/customers/all will fetch all data from MySQL
3. a GET RestAPI /api/customers/onebyid/:id will get a single data by primary key id
4. a PUT RestAPI /api/customers/update/:id will update an existed record in MySQL
5. a DELETE RestAPI /api/customers/delete/:id will delete an existed record in MySQL which is associated with a primary key id

– For advanced purpose such as Filtering, pagination and Sorting, we create the second RestAPIs group:

1. Filtering Request – a GET RestAPI /api/customers/filteringbyage is used to fetch all records from MySQL with a filtering by age
2. Pagination Request – a GET RestAPI /api/customers/pagination is used to fetch data from MySQL with pagination purpose.
3. Pagination Filtering and Sorting – a GET RestAPI /api/customers/pagefiltersort is defined to fetch data from MySQL with pagination, filtering by age and ordering by 2 fields firstname and lastname

Structure of Video:
0:1 Introduce Overview Architecture and Goal
0:42 Download Sourcecode Nodejs Express RestAPIs
1:16 Install Need Nodejs Dependencies
1:25 Import Nodejs project to Visual Studio Code
1:34 Begin Introduce Nodejs Project Structure
2:18 start DEBUG
2:29 Start MYSQL database to check tables customers creating by NODEJS application
2:46 DEBUG with POST request - Creating a CUSTOMER via POST API with Postman
3:55 Start DEBUG Coding with GET request - get all customers from MySQL database
5:05 Start filtering all customer from mysql database with age= 23
5:50 Start getting a single Customer from MySQL database via a given id with GET REstAPI
6:24 Start updating a Customer from MYSQL database with PUT request
7:21 Start Delete a customer from MySQL database with DELETE request
7:57 Start Pagination restapi request with limit & page queries parameters
9:11 Start Pagination and Filtering and Sorting request with 3 queries parameters: limit, page and age

Related posts:
1. Angular Nodejs Fullstack CRUD Application with MySQL/PostgreSQL – Angular 10-9-8 HttpClient + Nodejs Express, Sequelize ORM

2. Nodejs JWT Authentication Example – Express RestAPIs + JSON Web Token + BCryptjs + Sequelize + MySQL/PostgreSQL

3. Nodejs RestAPIs Upload Download Multiple Excel Files to MySQL/PostgreSQL – Multer, Sequelize ORM, Exceljs, Read-excel-file

***Sourcecode***

Рекомендации по теме
join shbcf.ru