cpularp-manager-api/src/gin-cpularp.go

38 lines
1.2 KiB
Go
Executable file

package main
import (
"log"
api "example.com/api"
authdiscord "example.com/auth/discord"
databasecommands "example.com/database/commands"
"github.com/gin-gonic/gin"
)
func main() {
api.GlobalDatabase = databasecommands.InitializeDatabase()
api.GlobalOAuth = authdiscord.CreateDiscordOAuthConfig(api.GlobalConfig)
log.Println(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/groups", api.GetDatabaseGroups)
app.GET("/get/all/groups", api.GetAllDatabaseGroups)
app.GET("/get/functions", api.GetDatabaseFunctions)
app.GET("/get/all/functions", api.GetAllDatabaseFunctions)
app.GET("/get/function-tags", api.GetDatabaseFunctionTags)
app.GET("/get/all/function-tags", api.GetAllDatabaseFunctionTags)
// Delete
app.Run(":31337")
}