课程: Databases for Node.js Developers (2021)

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Add MySQL and Sequelize to your project

Add MySQL and Sequelize to your project

- [Instructor] As you know, we store our basket in Redis, and now I want to transfer these basket items into an order when a user hits buy now, and this order should then be stored in MySQL, this is also a perfect use case for it, and as you might've guessed, we will use Sequalize as an abstraction for that. So let's head over to Visual Studio Code, and there I am in my shopper directory, I also have the application running. I stop it now. Please make sure that you are also in the shopper directory and there I now enter npm install sequelize and also MySQL too, because Sequelize works with a lot of different database systems, so we have to explicitly install the database driver that we want to use, and while this is installing I can already head over to server, config, index.js, and again, as we did with the other databases I will now add a new property, mysql, and in this MySQL property, I add a property…

内容