Restructure routes
This commit is contained in:
parent
7dce0fb4f4
commit
0b095f43bb
@ -18,41 +18,38 @@ func SetupMiddlewares(group *gin.RouterGroup) {
|
||||
}
|
||||
|
||||
func SetupRoutes(router *gin.Engine) {
|
||||
group := router.Group(command.Opts.Prefix)
|
||||
root := router.Group(command.Opts.Prefix)
|
||||
|
||||
group.GET("/", GetHome)
|
||||
group.GET("/static/*path", GetAsset)
|
||||
root.GET("/", GetHome)
|
||||
root.GET("/static/*path", GetAsset)
|
||||
root.GET("/connect/:resource", ConnectWithBackend)
|
||||
|
||||
api := group.Group("/api")
|
||||
{
|
||||
SetupMiddlewares(api)
|
||||
api := root.Group("/api")
|
||||
SetupMiddlewares(api)
|
||||
|
||||
if command.Opts.Sessions {
|
||||
api.GET("/sessions", GetSessions)
|
||||
}
|
||||
|
||||
api.GET("/info", GetInfo)
|
||||
api.POST("/connect", Connect)
|
||||
api.POST("/disconnect", Disconnect)
|
||||
api.POST("/switchdb", SwitchDb)
|
||||
api.GET("/databases", GetDatabases)
|
||||
api.GET("/connection", GetConnectionInfo)
|
||||
api.GET("/activity", GetActivity)
|
||||
api.GET("/schemas", GetSchemas)
|
||||
api.GET("/objects", GetObjects)
|
||||
api.GET("/tables/:table", GetTable)
|
||||
api.GET("/tables/:table/rows", GetTableRows)
|
||||
api.GET("/tables/:table/info", GetTableInfo)
|
||||
api.GET("/tables/:table/indexes", GetTableIndexes)
|
||||
api.GET("/tables/:table/constraints", GetTableConstraints)
|
||||
api.GET("/query", RunQuery)
|
||||
api.POST("/query", RunQuery)
|
||||
api.GET("/explain", ExplainQuery)
|
||||
api.POST("/explain", ExplainQuery)
|
||||
api.GET("/history", GetHistory)
|
||||
api.GET("/bookmarks", GetBookmarks)
|
||||
api.GET("/export", DataExport)
|
||||
if command.Opts.Sessions {
|
||||
api.GET("/sessions", GetSessions)
|
||||
}
|
||||
|
||||
group.GET("/connect/:resource", ConnectWithBackend)
|
||||
api.GET("/info", GetInfo)
|
||||
api.POST("/connect", Connect)
|
||||
api.POST("/disconnect", Disconnect)
|
||||
api.POST("/switchdb", SwitchDb)
|
||||
api.GET("/databases", GetDatabases)
|
||||
api.GET("/connection", GetConnectionInfo)
|
||||
api.GET("/activity", GetActivity)
|
||||
api.GET("/schemas", GetSchemas)
|
||||
api.GET("/objects", GetObjects)
|
||||
api.GET("/tables/:table", GetTable)
|
||||
api.GET("/tables/:table/rows", GetTableRows)
|
||||
api.GET("/tables/:table/info", GetTableInfo)
|
||||
api.GET("/tables/:table/indexes", GetTableIndexes)
|
||||
api.GET("/tables/:table/constraints", GetTableConstraints)
|
||||
api.GET("/query", RunQuery)
|
||||
api.POST("/query", RunQuery)
|
||||
api.GET("/explain", ExplainQuery)
|
||||
api.POST("/explain", ExplainQuery)
|
||||
api.GET("/history", GetHistory)
|
||||
api.GET("/bookmarks", GetBookmarks)
|
||||
api.GET("/export", DataExport)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user