Publishing Web Pages

Learn how to publish and return web pages from a custom web server.

We'll cover the following...

Finally, let’s learn how to serve HTML content so that your web server can come into its own. For example, GET HTTP requests to the "/hello" route should show a basic web page. A naive way to do so would be to simply return an HTML string.

Return the HTML content

However, things would quickly get out of hands as the complexity of the web page grows. A better solution is to define the HTML content in an external file stored in a dedicated subfolder, and return that file as a result of the request. For example, create a subfolder named views and a ...