-
Notifications
You must be signed in to change notification settings - Fork 38
/
router.go
40 lines (33 loc) · 1002 Bytes
/
router.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main
import (
"github.com/gin-gonic/gin"
swaggerfiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
"luma-api/docs"
"luma-api/middleware"
)
func RegisterRouter(r *gin.Engine) {
r.GET("/ping", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "pong",
})
})
docs.SwaggerInfo.BasePath = "/"
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerfiles.Handler))
apiRouter := r.Group("/luma", middleware.SecretAuth())
{
//old 废弃
apiRouter.POST("/generations/", Generations)
// current
//apiRouter.GET("/generations/*action", Fetch)
// submit
apiRouter.POST("/generations", Generations)
apiRouter.POST("/generations/:task_id/extend", ExtentGenerations)
apiRouter.POST("/generations/file_upload", Upload)
// get data
apiRouter.GET("/generations/:task_id", FetchByID)
apiRouter.GET("/generations/:task_id/download_video_url", GetDownloadUrl)
apiRouter.GET("/subscription/usage", Usage)
apiRouter.GET("/users/me", Me)
}
}