Hello, I want to get heavily into Golang for web development. I’m concerned that if I don’t leverage some great web tech like Caddy that I’ll end up spending more time writing my own web server than I will writing the business logic. Can anyone point me in the right direction for using Caddy as a front end of sorts for a good Golang web framework? Are there plugins to integrate or something like that? I’m very familiar with PHP and I found Caddy to be an amazing tool for portable development due to the Caddyfile. I’m open to new ideas for web development so anything goes.
The Go standard library’s HTTP server is rock solid and very easy to use.
There’s a number of very good request routers that make things much easier, too. I like julienschmidt/httprouter. Gorilla web toolkit for Go is also very useful, and has gorilla/mux, another good option for a router.
Pretty much no matter how you go about it, though, you’ll need a request router to match up incoming requests to actual application logic. Then you can put Caddy in front.
I’d recommend either:
- Keeping Caddy and your program separate, and setting up Caddy to reverse proxy to your program, which you can simply design to listen on a higher port by default.
- Importing mholt/certmagic into your Go program if you want Caddy’s powerful Automatic HTTPS functionality in front of your request router. It’s essentially as simple as calling CertMagic instead of the Go standard library’s
http.ListenAndServeand feeding it your request router. This removes the need to run Caddy in front, assuming your server is only going to be serving this program over HTTP and not any other virtual sites.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.