集成UI
This commit is contained in:
parent
b2324e60a8
commit
217e9274c6
7
main.go
7
main.go
@ -42,6 +42,7 @@ var redisClient redis.Conn
|
|||||||
func main() {
|
func main() {
|
||||||
gin.SetMode(gin.ReleaseMode)
|
gin.SetMode(gin.ReleaseMode)
|
||||||
router := gin.Default()
|
router := gin.Default()
|
||||||
|
router.LoadHTMLGlob("public/*.html")
|
||||||
|
|
||||||
port := flag.Int("port", defaultPort, "服务端口")
|
port := flag.Int("port", defaultPort, "服务端口")
|
||||||
domain := flag.String("domain", "", "短链接域名,必填项")
|
domain := flag.String("domain", "", "短链接域名,必填项")
|
||||||
@ -67,6 +68,12 @@ func main() {
|
|||||||
}
|
}
|
||||||
initRedisPool()
|
initRedisPool()
|
||||||
|
|
||||||
|
router.GET("/", func(context *gin.Context) {
|
||||||
|
context.HTML(http.StatusOK, "index.html", gin.H{
|
||||||
|
"title": "MyUrls",
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
router.POST("/short", func(context *gin.Context) {
|
router.POST("/short", func(context *gin.Context) {
|
||||||
res := &Response{
|
res := &Response{
|
||||||
Code: 1,
|
Code: 1,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user