mirror of
https://github.com/sosedoff/pgweb.git
synced 2024-12-15 11:52:12 +03:00
33 lines
834 B
Go
33 lines
834 B
Go
package api
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func SetupRoutes(router *gin.Engine) {
|
|
router.GET("/", GetHome)
|
|
router.GET("/static/*path", GetAsset)
|
|
|
|
api := router.Group("/api")
|
|
{
|
|
api.Use(dbCheckMiddleware())
|
|
|
|
api.POST("/connect", Connect)
|
|
api.GET("/databases", GetDatabases)
|
|
api.GET("/connection", GetConnectionInfo)
|
|
api.GET("/activity", GetActivity)
|
|
api.GET("/schemas", GetSchemas)
|
|
api.GET("/tables", GetTables)
|
|
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("/query", RunQuery)
|
|
api.POST("/query", RunQuery)
|
|
api.GET("/explain", ExplainQuery)
|
|
api.POST("/explain", ExplainQuery)
|
|
api.GET("/history", GetHistory)
|
|
api.GET("/bookmarks", GetBookmarks)
|
|
}
|
|
}
|