Course of Raku / Functional, concurrent, reactive, and web programming / Web programming / A simple HTTP server / Exercises

An HTML response

Problem

Write a server that accepts one connection and sends back a valid HTTP response whose body is the HTML <h1>Hello, web!</h1>. Use a Content-Type: text/html header so the browser renders it as a heading. Remember the status line, the header, and the blank line before the body.

Run it, then open http://127.0.0.1:8080/ in a browser to see the result.

Example

In the browser, the page shows a large heading:

Hello, web!

Solution

See the solution

Course navigation

Solution: A hello server   |   Solution: An HTML response