mirror of
https://github.com/labstack/echo.git
synced 2025-12-07 23:12:43 +02:00
@@ -3,15 +3,17 @@ package main
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"golang.org/x/crypto/acme/autocert"
|
||||
|
||||
"github.com/labstack/echo"
|
||||
"github.com/labstack/echo/middleware"
|
||||
)
|
||||
|
||||
func main() {
|
||||
e := echo.New()
|
||||
// e.AutoTLSManager.HostPolicy = autocert.HostWhitelist("<your_domain>")
|
||||
// Store the certificate to avoid issues with rate limits (https://letsencrypt.org/docs/rate-limits/)
|
||||
// e.AutoTLSManager.Cache = autocert.DirCache("<path to store key and certificate>")
|
||||
// e.AutoTLSManager.HostPolicy = autocert.HostWhitelist("<DOMAIN>")
|
||||
// Cache certificates
|
||||
e.AutoTLSManager.Cache = autocert.DirCache("/var/www/.cache")
|
||||
e.Use(middleware.Recover())
|
||||
e.Use(middleware.Logger())
|
||||
e.GET("/", func(c echo.Context) error {
|
||||
|
||||
Reference in New Issue
Block a user