add pocketbase
This commit is contained in:
26
backend/custom/version/version.go
Normal file
26
backend/custom/version/version.go
Normal file
@ -0,0 +1,26 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/pocketbase/pocketbase"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/tools/router"
|
||||
)
|
||||
|
||||
var Version string
|
||||
var BuildDate string
|
||||
var Company string
|
||||
var CompanyUrl string
|
||||
|
||||
func ServeVersionInfo(app *pocketbase.PocketBase, se *core.ServeEvent) *router.Route[*core.RequestEvent] {
|
||||
return se.Router.GET("/api/version/send", func(e *core.RequestEvent) error {
|
||||
|
||||
return e.JSON(http.StatusOK, map[string]string{
|
||||
"version": Version,
|
||||
"build_date": BuildDate,
|
||||
"company": Company,
|
||||
"company_url": CompanyUrl,
|
||||
})
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user