课程: React: Creating and Hosting a Full-Stack Site
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Upvoting articles
- [Instructor] All right, well, now that we've seen some basic examples of how an Express server works, as well as the most important parts that we're going to need to use in our server here, such as route parameters and request bodies, let's make our server do something a little bit more relevant to our blog. What we want here is for users to be able to upvote our articles so that we can help other users see which articles are the most popular or the most helpful. Now, in order to do this, we're going to of course need to add some code to our backend, and the first thing that we're going to do for that is, we're going to create sort of a fake in-memory database for our server, which will keep track of the upvotes for our articles. Now, later on, we're going to actually add a real database with MongoDB to our server, but for now, just to keep things simple, we're going to just use a JavaScript array to make this happen, and what that's going to look like is up here above where we…