upda/server/api_handler_info.go
Varakh 1fc3818d3c
All checks were successful
/ build (push) Successful in 5m3s
feature(api,release): prepare for next major release and switch to requiring content-type set to JSON for all incoming requests and expose more CORS environment variables
- Switched to enforce JSON as Content-Type for all incoming requests
- Switched to properly respond with JSON on page not found or method not allowed
- Renamed CORS_ALLOW_ORIGIN to CORS_ALLOW_ORIGINS
- Added CORS_ALLOW_CREDENTIALS which defaults to true
- Added CORS_EXPOSE_HEADERS which defaults to *
- Overhauled package visibility for server module
2024-06-10 20:03:25 +02:00

23 lines
433 B
Go

package server
import (
"git.myservermanager.com/varakh/upda/api"
"github.com/gin-gonic/gin"
"net/http"
)
type infoHandler struct {
appConfig appConfig
}
func newInfoHandler(a *appConfig) *infoHandler {
return &infoHandler{appConfig: *a}
}
func (h *infoHandler) show(c *gin.Context) {
c.JSON(http.StatusOK, api.DataResponse{Data: gin.H{
"name": name,
"version": version,
"timeZone": h.appConfig.timeZone,
}})
}