Getting Some Style
Up to now, you've seen how to serve one static page and you might consider serving a few pages with the same method, maybe creating a handler struct with the name of the file to serve as an attribute. This might be impractical for large numbers of pages, although, in some cases, it is necessary. A web page, however, does not include just HTML code, but also images and styles, and some frontend code. It is not within the scope of this book to teach how to build HTML pages, and even less how to write JavaScript code or CSS style sheets, but you need to know how to serve these documents as we use a small CSS file to build our example. Serving static files and putting templates in different files, or generally using external resources, is a good way to separate concerns on our projects, and makes our projects more manageable and maintainable, so you should try to follow this approach in all your projects.
In order to add a style sheet to your HTML pages, you...