课程: React: Creating and Hosting a Full-Stack Site (2022)
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Adding MongoDB to Express
- [Instructor] All right, so now that we've got MongoDB up and running on our machine as well as some basic data we can use for development, let's see how we can incorporate this into our Express server. Now, the first thing that we're going to want to do, of course, is install the MongoDB driver package into our project. And we can do that by just saying npm install mongodb, and hitting Enter, all right. So that's the name of the NPM package here. And this package is basically just going to allow us to do the same thing inside our Node.js code as we did in the Mongo shell, right? So it will allow us to connect to a database and make queries to that database. So since we're going to be connecting to the database and using that data now, what we can do is actually remove this article's info array. And eventually we're going to need to replace a lot of the logic inside these endpoints that we defined, since instead of just…