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() // Authentication Workflow app.GET("/auth/callback", api.AuthCallback) app.GET("/auth/login", api.AuthLoginRedirect) app.GET("/auth/logout", api.AuthLogoutRedirect) // Create & Update app.POST("/post/user/update", api.CreateOrUpdateUser) app.POST("/post/group", api.CreateDatabaseGroup) app.POST("/post/function", api.CreateDatabaseFunction) app.POST("/post/function-tag", api.CreateDatabaseFunctionTag) // Read app.GET("/get/user/info", api.GetUserInfo) app.GET("/get/user/authorized", api.GetIsUserAuthorized) app.GET("/get/group", api.GetDatabaseGroup) app.GET("/get/groups", api.GetDatabaseGroups) app.GET("/get/function", api.GetDatabaseFunction) app.GET("/get/functions", api.GetDatabaseFunctions) app.GET("/get/function-tag", api.GetDatabaseFunctionTag) app.GET("/get/function-tags", api.GetDatabaseFunctionTags) // Delete app.Run(":31337") }