课程: Databases for Node.js Developers
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Setting up the database connection
- [Instructor] To start using Sequelize with MySQL, we first need to install the necessary packages. So I already opened my terminal, I terminated our application, and now I type npm install sequelize, and also, mysql2. This install Sequelize, the ORM we'll use to interact with the database, and mysql2, the driver Sequelize uses to connect to MySQL. Now I will start my app again by running npm run dev. And with these installed, we are ready to set up the database connection in our Fastify application. And you will see that it's fairly similar to what we did with MongoDB, and that's a good sign because this means that we are consistent in the way we are doing things. So what we will do here is we will connect Fastify to MySQL by completing the Sequelize plugin that is already in our project. This plugin will handle connecting to MySQL using Sequelize and make the connection available across the app. But before we do this, and that's, again, similar to what we did with MongoDB, I go…
内容
-
-
-
-
-
-
(已锁定)
Using MySQL for our users and orders1 分钟 8 秒
-
(已锁定)
Setting up MySQL with Docker2 分钟 49 秒
-
(已锁定)
Exploring MySQL with MySQL Workbench1 分钟 57 秒
-
(已锁定)
Introducing Sequelize1 分钟 51 秒
-
(已锁定)
Setting up the database connection7 分钟 43 秒
-
(已锁定)
Designing the database structure2 分钟 1 秒
-
(已锁定)
Creating a user model for Sequelize7 分钟 47 秒
-
(已锁定)
Creating the order models for Sequelize11 分钟 56 秒
-
(已锁定)
Loading and syncing the models13 分钟 5 秒
-
(已锁定)
Creating, updating and deleting users with Sequelize12 分钟 52 秒
-
(已锁定)
Securing credentials with password hashing7 分钟 2 秒
-
(已锁定)
Implementing the user login9 分钟 15 秒
-
(已锁定)
-
-
-