24 lines
678 B
Go
24 lines
678 B
Go
![]() |
package main
|
||
|
|
||
|
import (
|
||
|
api "example.com/api"
|
||
|
authdiscord "example.com/auth/discord"
|
||
|
configserver "example.com/config/server"
|
||
|
databasecommands "example.com/database/commands"
|
||
|
|
||
|
"github.com/gin-gonic/gin"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
api.GlobalDatabase = databasecommands.InitializeDatabase()
|
||
|
api.GlobalConfig = configserver.ParseConfig("../config.toml")
|
||
|
api.GlobalOAuth = authdiscord.CreateDiscordOAuthConfig(api.GlobalConfig)
|
||
|
app := gin.Default()
|
||
|
app.GET("/login", api.LoginRedirect)
|
||
|
app.GET("/auth/callback", api.AuthCallback)
|
||
|
app.GET("/logout", api.LogoutRedirect)
|
||
|
app.GET("/dashboard", api.GetDashboardInfo)
|
||
|
app.GET("/authorized", api.IsUserAuthorized)
|
||
|
app.Run(":31337")
|
||
|
}
|