updates
This commit is contained in:
43
main.go
43
main.go
@@ -2,10 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
||||
"github.com/DeveloperDurp/DurpAPI/controller"
|
||||
_ "github.com/DeveloperDurp/DurpAPI/docs"
|
||||
@@ -67,37 +64,10 @@ func main() {
|
||||
|
||||
v1 := r.Group("/api/v1")
|
||||
{
|
||||
accounts := v1.Group("/accounts")
|
||||
{
|
||||
accounts.GET(":id", c.ShowAccount)
|
||||
accounts.GET("", c.ListAccounts)
|
||||
accounts.POST("", c.AddAccount)
|
||||
accounts.DELETE(":id", c.DeleteAccount)
|
||||
accounts.PATCH(":id", c.UpdateAccount)
|
||||
accounts.POST(":id/images", c.UploadAccountImage)
|
||||
}
|
||||
bottles := v1.Group("/bottles")
|
||||
{
|
||||
bottles.GET(":id", c.ShowBottle)
|
||||
bottles.GET("", c.ListBottles)
|
||||
}
|
||||
admin := v1.Group("/admin")
|
||||
{
|
||||
admin.Use(auth())
|
||||
admin.POST("/auth", c.Auth)
|
||||
}
|
||||
examples := v1.Group("/examples")
|
||||
{
|
||||
examples.GET("ping", c.PingExample)
|
||||
examples.GET("calc", c.CalcExample)
|
||||
examples.GET("groups/:group_id/accounts/:account_id", c.PathParamsExample)
|
||||
examples.GET("header", c.HeaderExample)
|
||||
examples.GET("securities", c.SecuritiesExample)
|
||||
examples.GET("attribute", c.AttributeExample)
|
||||
}
|
||||
openai := v1.Group("/openai")
|
||||
{
|
||||
openai.GET("general", c.GeneralOpenAI)
|
||||
openai.GET("travelagent", c.TravelAgentOpenAI)
|
||||
}
|
||||
}
|
||||
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
||||
@@ -113,14 +83,3 @@ func auth() gin.HandlerFunc {
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
fmt.Println("Running swag init...")
|
||||
cmd := exec.Command("swag", "init")
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
if err := cmd.Run(); err != nil {
|
||||
fmt.Println("Error running swag init:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user