From the course: Web Servers and APIs using C++
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Solution: Create a webpage with data - C++ Tutorial
From the course: Web Servers and APIs using C++
Solution: Create a webpage with data
(upbeat delicate music) - [Instructor] How did you do with this challenge? Hopefully it wasn't difficult. Here's how I solved it. I modified the contact route to pass the contact data. Then I created contact.html by copying contacts.html, and finally I modified the contact's html markup, and added the contact data to it. Let's begin. Go back into Atom, and right here, let's go ahead and modify. The very first unit we need to do, is we're gonna say, crow colon colon json colon colon wvalue and that's gonna be our dto. Then I say dto. The name of the data in the dto is gonna be contact singular. And it's gonna be equal to and I'm just gonna copy everything that is right here except I don't need that last set of parentheses. And the only other thing that I need to do is I need to force send this through json load. So json colon colon load then wrap this parentheses and so this bson to json doc.value.view and that's gonna be our contact data. And then our return object is going to be…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Creating an mLab account1m 40s
-
(Locked)
Uploading JSON data4m 39s
-
(Locked)
Adding the MongoDB C++ drivers3m 52s
-
Querying Mongo data15m 24s
-
(Locked)
Adding dynamic data to a page13m 35s
-
(Locked)
Challenge: Create a webpage with data32s
-
(Locked)
Solution: Create a webpage with data4m 50s
-
(Locked)
-
-
-