Documentation ¶
Index ¶
- Variables
- func ApisHandler(c *gin.Context)
- func CaptchaHandler() gin.HandlerFunc
- func CounterMiddleware() gin.HandlerFunc
- func ErrorPage(fsys fs.FS, msg string, err error) string
- func ErrorTmpl(fsys fs.FS, msg string, err error) string
- func FAQPage(fsys fs.FS) string
- func FooterPage(fsys fs.FS) string
- func HeaderPage(fsys fs.FS) string
- func InitServer(webServer srvConfig.WebServer)
- func ParseTmpl(tdir, tmpl string, data interface{}) (string, error)
- func Router(routes []Route, fsys fs.FS, static string, webServer srvConfig.WebServer) *gin.Engine
- func SuccessTmpl(fsys fs.FS, msg string) string
- func TmplPage(fsys fs.FS, tmpl string, tmplData TmplRecord) string
- type GinRoute
- type Mem
- type Memory
- type Route
- type Templates
- type TmplRecord
Constants ¶
This section is empty.
Variables ¶
var Time0 time.Time
Time0 represents initial time when we started the server
var TotalDeleteRequests uint64
TotalDeleteRequests counts total number of DELETE requests received by the server
var TotalGetRequests uint64
TotalGetRequests counts total number of GET requests received by the server
var TotalPostRequests uint64
TotalPostRequests counts total number of POST requests received by the server
var TotalPutRequests uint64
TotalPutRequests counts total number of PUT requests received by the server
Functions ¶
func ApisHandler ¶ added in v0.0.1
ApisHandler provides JSON output for server routes
func CaptchaHandler ¶
func CaptchaHandler() gin.HandlerFunc
CaptchaHandler provides access to captcha server
func CounterMiddleware ¶
func CounterMiddleware() gin.HandlerFunc
CounterMiddleware counts GET/POST/PUT/DELETE requests
func InitServer ¶ added in v0.0.2
InitServer provides server initialization
func Router ¶ added in v0.0.1
Router provids server router, it takes two maps: one for non-authorized routes and anotehr for authorized ones
func SuccessTmpl ¶
SuccessTmpl provides success template message
Types ¶
type Memory ¶
type Memory struct { Total uint64 `json:"total"` Free uint64 `json:"free"` Used uint64 `json:"used"` UsedPercent float64 `json:"usedPercent"` }
Memory structure keeps track of server memory
type Route ¶ added in v0.0.1
type Route struct { Method string Path string Scope string Authorized bool Handler gin.HandlerFunc }
Route represents routes structure
type Templates ¶ added in v0.0.1
type Templates struct {
// contains filtered or unexported fields
}
Templates structure
type TmplRecord ¶ added in v0.0.1
type TmplRecord map[string]interface{}
TmplRecord represent template record
func MakeTmpl ¶
func MakeTmpl(fsys fs.FS, title string) TmplRecord
helper function to make initial template struct
func (TmplRecord) GetBytes ¶ added in v0.0.1
func (t TmplRecord) GetBytes(key string) []byte
GetBytes returns bytes object for given key
func (TmplRecord) GetElapsedTime ¶ added in v0.0.1
func (t TmplRecord) GetElapsedTime() string
GetElapsedTime returns elapsed time
func (TmplRecord) GetError ¶ added in v0.0.1
func (t TmplRecord) GetError() string
GetError returns error string
func (TmplRecord) GetInt ¶ added in v0.0.1
func (t TmplRecord) GetInt(key string) int
GetInt converts given value for provided key to int data-type
func (TmplRecord) GetString ¶ added in v0.0.1
func (t TmplRecord) GetString(key string) string
GetString converts given value for provided key to string data-type