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.

Creating HTML pages

Creating HTML pages - C++ Tutorial

From the course: Web Servers and APIs using C++

Start my 1-month free trial

Creating HTML pages

- [Instructor] In our first code example, we built the HTML snippet from a string. Building HTML from strings is terrible and it would be a torturous way to build a website. There are two main ways to create HTML in Crow. The first is to put a pure HTML document in a file by itself and deliver the file when requested. Nearly every web framework has this option, including Crow. The second way is similar, but instead of the file containing pure HTML, it is a mixture of HTML and Mustache templates. Mustache is a prominent web template system. Its first release was in 2009 and there are ports available in nearly every modern language. Mustache is excellent at mixing data into HTML and we'll cover it more once we add MongoDB into the mix. Our recipe for creating HTML pages in Crow is simple. For each page, let's create a matching HTML file and a route handler. It is possible for a singe route to handle multiple pages, but we'll keep it simple for now. We'll store the HTML files together in…

Contents