From the course: Databases for Node.js Developers (2021)
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Introduction to Sequelize
From the course: Databases for Node.js Developers (2021)
Introduction to 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's not exclusive for MySQL. It supports MySQL, but also SQLite, PostgreSQL, and Microsoft SQL Server. Additionally to being a database abstraction layer, it's also an object relational mapper, an ORM, very similar to Mongoose, which is an object document mapper. So as we did it with Mongoose we could not do something like that. I could define a car and a property, make on it, and I can tell Sequelize that this should be a string. And then I call sequelize.sync in a special line different from Mongoose because this will synchronize the database model here with the database. So basically, it really creates the static table for us in MySQL. Then I call Car.create and pass in the make, and it's Ford in my case, and this, again, returns a promise and in the then block I can…
Contents
- (Locked)When to use relational databases59s
- (Locked)Set up MySQL3m 20s
- (Locked)Create a database schema4m 17s
- (Locked)Use Node.js with MySQL9m 58s
- (Locked)Introduction to Sequelize2m 4s
- (Locked)Add MySQL and Sequelize to your project6m 28s
- (Locked)Review the database design2m
- (Locked)Create sequelize models8m 51s
- (Locked)Review the auto-generated database structure2m 20s
- (Locked)Implement an order service8m 29s
- (Locked)Add order management7m 13s
- (Locked)