Zig std lib Server Hello World Example?

I am not able to understand from the std lib documentation how to make a hello world app with the Zig http server. For example, a server listening on localhost:8080 that returns

<!DOCTYPE html>
<title>Hello World Page</title>

<p>Hello world!</p>


Thanks for any help!

You can find a TCP server example, as well as an HTTP client, on Zig By Example. Im not sure either how to do the HTTP server, but you will need to print the HTML line by line either way, like you would on a console app

1 Like

I think I misunderstood the nature of the http server. I was thinking it was like the Go http server, which allowed for the creation of web apps easily. It sounds like this is a lower level implementation?

Yes, HTTP in Zig is low level. Maybe you are looking for Zap.

1 Like