This course has been updated! We now recommend you take the AWS for Front-End Engineers (ft. S3, Cloudfront & Route 53) course.
Transcript from the "Sequelize & PostgreSQL" Lesson
[00:00:00]
>> [MUSIC]
[00:00:04]
>> Kevin Whinnery: Got two more big media sections here this afternoon before I turn you loose. The first is digging into the data tier of the application that we've been looking at today. And in this, case we're actually gonna be looking at how to use Node.js with a relational database.
[00:00:22] Anyway, so the stack we're going to look at is one that's actually. You know, less less heralded in Node. Because most of the no sequel databases out there. Because they sort of natively speak JSON end up being a really good fit for node.js. But for certain use cases, there are relational database does make a lot of sense.
[00:00:51] And particularly post grads is actually a really feature rich relational database which can do a lot of interesting stuff that JavaScript can take advantage of. Particularly with its JSON fields allowing you within a table to have you know of a rich query like a unstructured query a bowl column with JSON data embedded in it.
[00:01:14] So still a really great choice for node.js development. And specifically, it allows us to use RDS which is the managed relational database service from Amazon which is very perform entirely available all those things. All right. So if you're gonna be using a relational database of any kind with Node.js, the chances are you're probably gonna go one of two routes.
[00:01:41] You're gonna either use a driver for your database directly. So just to use pg, or you know postgresql, or on MySQL driver directly. Maybe, execute Ross equal against it or maybe use a SQL builder. But if you're using an RM, and no JS, you're probably going to use sequelize.
[00:01:59] Sequelize is definitely the most feature rich or and that's out there for node.JS today. So if you're looking for the type of experience that you might have enjoyed with say active record which is kind of for me I like the gold standard to which I will compare all.
[00:02:17] It definitely has its problems but I feel like it's a great piece software. It's probably the closest you're going to get to that in the node.js world. That said this is another situation where if you choose to use Sequelize the support that you're going to find out there on the inner webs is not awesome.
[00:02:39] There aren't a lot of tutorials. There aren't a lot of resources, there aren't a lot of sample apps that have been built using Sequelize. So, you're gonna be a little bit in the wilderness, if you use Sequelize. The documentation is pretty okay, but there's a lot of things that go unsaid that you occasionally have to dive into the source to figure out.
[00:03:01] But all that said it definitely is of all the out there on top of a relational database. I think it's definitely a crime to cram. But yeah. As I mentioned isn't SQL for old people like should we be using no SQL databases. And there's some reasons why you might want to consider going with a no SQL database for node mostly because the support for no SQL databases in node is much better.
[00:03:28] Like there's a lot more folks using those technologies, a lot more resources available. The libraries are a little bit better for instance like mongoose which is the ODM the object Document Map for Mongo DB. I think is particularly good, but the main reason that I've gone with SQL is that postgres itself is an awesome feature rich database.
[00:03:52] RDS was a good choice within our Amazon centric Ecosystem and always gonna be the best data store solution for us. So the opportunity go it RDS was it was definitely a driving factor in making that choice.