From 217e9274c6cd8002e6f788900fc41f20b05c5707 Mon Sep 17 00:00:00 2001 From: CareyWong Date: Mon, 30 Mar 2020 00:38:45 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9B=86=E6=88=90UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.go b/main.go index 1d25b7c..b3b353f 100644 --- a/main.go +++ b/main.go @@ -42,6 +42,7 @@ var redisClient redis.Conn func main() { gin.SetMode(gin.ReleaseMode) router := gin.Default() + router.LoadHTMLGlob("public/*.html") port := flag.Int("port", defaultPort, "服务端口") domain := flag.String("domain", "", "短链接域名,必填项") @@ -67,6 +68,12 @@ func main() { } initRedisPool() + router.GET("/", func(context *gin.Context) { + context.HTML(http.StatusOK, "index.html", gin.H{ + "title": "MyUrls", + }) + }) + router.POST("/short", func(context *gin.Context) { res := &Response{ Code: 1,