comparison main.go @ 12:aaf85ae1f942

add very simple html template
author Dennis C. M. <dennis@denniscm.com>
date Thu, 20 Mar 2025 11:12:21 +0000
parents 5c124578fed2
children
comparison
equal deleted inserted replaced
11:6d91c612310a 12:aaf85ae1f942
1 package main 1 package main
2 2
3 import ( 3 import (
4 "github.com/denniscmcom/pacobot/api" 4 "github.com/denniscmcom/pacobot/api"
5 "github.com/denniscmcom/pacobot/app"
5 "github.com/gin-gonic/gin" 6 "github.com/gin-gonic/gin"
6 ) 7 )
7 8
8 func main() { 9 func main() {
9 gin.SetMode(gin.DebugMode) 10 gin.SetMode(gin.DebugMode)
10 11
11 r := gin.Default() 12 r := gin.Default()
13 r.LoadHTMLGlob("./www/**/*.html")
14 r.Static("/static", "./www/static")
12 15
13 r.GET("/user", api.GetUserHandler) 16 r.GET("/", app.Index)
14 r.GET("/auth", api.AuthHandler) 17
15 r.GET("/auth-validate", api.AuthValidateHandler) 18 {
16 r.GET("/auth-refresh", api.AuthRefreshHandler) 19 apiG := r.Group("/api")
17 r.GET("/auth-revoke", api.AuthRevokeHandler) 20 apiG.GET("/user", api.GetUser)
18 r.GET("/twitch-auth-code-callback", api.TwitchCallbackHandler) 21 apiG.GET("/connect", api.Connect)
19 r.GET("/connect", api.ConnectHandler) 22
23 {
24 authG := apiG.Group("/auth")
25 authG.GET("/", api.Auth)
26 authG.GET("/validate", api.AuthValidate)
27 authG.GET("/refresh", api.AuthRefresh)
28 authG.GET("/revoke", api.AuthRevoke)
29 authG.GET("/twitch", api.Twitch)
30 }
31
32 }
20 33
21 r.Run() 34 r.Run()
22 } 35 }