feat: support Let's Encrypt tls.
This commit is contained in:
		
							
								
								
									
										17
									
								
								examples/auto-tls/main.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								examples/auto-tls/main.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,17 @@
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/gin-gonic/gin"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
	r := gin.Default()
 | 
			
		||||
 | 
			
		||||
	// Ping handler
 | 
			
		||||
	r.GET("/ping", func(c *gin.Context) {
 | 
			
		||||
		c.String(200, "pong")
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	// Listen and Server in 0.0.0.0:443
 | 
			
		||||
	r.RunAutoTLS(":443", "/var/www/.cache", "example.com")
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user