The following is a simple program that demonstrates how to write an HTTPS web server that returns a count of the number of visitors. More generally, it shows the basic pattern for implementing a Handler for an HTTP endpoint.
The complete source is available as a zip file.