Go service as a web server
Serve HTML, CSS and Javascript files
Published in
7 min readDec 21, 2020
- part: creating the service
- part: improving the service
- part: you are reading it right now
- part: adding SSE
- part: simple javascript frontend functionality
- part: frontend — backend communication
- part: server-side logging
- part: run it all in docker
- part: adding database container
- part: database — service communication
Addition 1: functions, methods, pointers and interfaces
Addition 2: websocket communication
Addition 3: socket communication
Why should you use Go as a web server?
That is a valid question. We have Apache, Nginx, IIS and bunch of other web servers. You can write web server in Java, Node, PHP or whatever else.
So why use Go?
Because creating Go web server is simple. Because Go web server is fast. Because you can run your web server a a single executable. Because you can run it on all three major systems the same way. Because you can run it easily in Docker. And because you can use one technology— Go…