From the course: Databases for Node.js Developers
Unlock this course with a free trial
Join today to access over 24,400 courses taught by industry experts.
Introducing Sequelize - Node.js Tutorial
From the course: Databases for Node.js Developers
Introducing Sequelize
- [Instructor] To use MySQL in our sample project, we will now use Sequelize. Sequelize is a popular database abstraction layer for Node.JS and it supports a few databases like MySQL, SQLite, Postgres, and Microsoft SQL Server. Additionally to being a database abstraction layer, it's also a object relational mapper, which is very similar to Mongoose, which is a object document mapper. So as we did with Mongoose, we could now do something like this. I could define something like a schema or model using SQL as define, and I call it car, and I say it has a make and this make is of the data type string. And then we can very simply just sync this model to MySQL and it'll be automatically created. And then I can create a database record for this car and it'll be stored to MySQL. And now I can, for instance, log it out or set more properties on it, et cetera. You see, that's very similar to Mongoose. Now let's look at something important, it's transactions. So how can transactions be created…
Contents
-
-
-
-
-
-
(Locked)
Using MySQL for our users and orders1m 8s
-
(Locked)
Setting up MySQL with Docker2m 49s
-
(Locked)
Exploring MySQL with MySQL Workbench1m 57s
-
(Locked)
Introducing Sequelize1m 51s
-
(Locked)
Setting up the database connection7m 43s
-
(Locked)
Designing the database structure2m 1s
-
(Locked)
Creating a user model for Sequelize7m 47s
-
(Locked)
Creating the order models for Sequelize11m 56s
-
(Locked)
Loading and syncing the models13m 5s
-
(Locked)
Creating, updating and deleting users with Sequelize12m 52s
-
(Locked)
Securing credentials with password hashing7m 2s
-
(Locked)
Implementing the user login9m 15s
-
(Locked)
-
-
-