Awesome
autotls
Support Let's Encrypt for Hertz.
How to start it
- Prepare a VM and a domain.
- Create a new DNS A record targeting your VM public IP.
- Write code and compile it.
- Start the binary.
- Open your browser with the address of your DNS domain.
Example
func main() {
h := server.Default(
server.WithTLS(autotls.NewTlsConfig("your domain")),
server.WithHostPorts(":https"),
)
// Ping handler
h.GET("/ping", func(c context.Context, ctx *app.RequestContext) {
ctx.JSON(200, map[string]interface{}{
"ping": "pong",
})
})
hlog.Fatal(autotls.Run(h))
}
More examples can be found in the examples directory.