3 ms·
It's a nice reference program to show you what's going on. I build stuff like this for a living. I'd recommend not re-inventing the wheel yourself and using a
by oppositelock 9y ago
It's a nice reference program to show you what's going on.
I build stuff like this for a living. I'd recommend not re-inventing the wheel yourself and using a nice web framework, like Echo (https://github.com/labstack/echo https://github.com/labstack/echo) or Gin (https://github.com/gin-gonic/gin https://github.com/gin-gonic/gin). I prefer Echo due to a cleaner, mockable design, but they're equivalent.
You can throw up that web server in 1/10 the code to do the same thing, and using built-in middleware is less work than writing your own.
- dstroot 9y agoI tend to agree and I’d throw Chi in the mix. I like Chi quite a bit. Or, use the Gorilla components and middleware.
- pdappollonio 9y agoI also use Chi a lot and Chi and this example are actually complimentary: you can take the Chi router and pass it to an http.Server in the handler attribute to make it work.
- sethammons 9y agoI also build stuff like this for a living and I tend to avoid frameworks :) I don't care for Gin. I'll take a look at Echo.