# README
Server module
This repository contains codebase to define FOXDEN/CHESS HTTP server functionality. It provides common router, server functions and middleware shared among all FOXDEN/CHESS services.
# Functions
ApisHandler provides JSON output for server routes.
CaptchaHandler provides access to captcha server.
CounterMiddleware counts GET/POST/PUT/DELETE requests.
ErrorPage returns error page.
ErrorTmpl provides error template message.
Generates an Etag for given string, provided by https://github.com/amalfra/etag.
FAQPage provides FAQ page.
FooterPage returns footer page.
GinHandlerFunc converts given http.Handler to gin.HandlerFunc.
HeaderMiddleware represents header middleware.
HeaderPage returns header page.
InitServer provides server initialization.
LoggerMiddleware is custom logger for gin server.
helper function to make initial template struct.
MDToHTML function to generate HTML from given markdown file.
MetricsHandler provides metrics JSON for monitoring purposes (Prometheus).
MetricsPage represents metrics page.
ParseTmpl parses template with given data.
ProcFSMetrics returns procfs (prometheus) metrics.
QLKeysHandler provides list of keys used in QueryLanguage in given service.
Router provids server router, it takes two maps: one for non-authorized routes and anotehr for authorized ones.
StartServer starts HTTP(s) server.
SuccessTmpl provides success template message.
TmplPage parses given template and return HTML page.
# Variables
AvgGetRequestTime represents average GET request time.
AvgPostRequestTime represents average POST request time.
AvgPutRequestTime represents average PUT request time.
LimiterMiddleware provides limiter middleware pointer.
MetricsLastUpdateTime keeps track of last update time of the metrics.
NumLogicalCores represents number of cores in our node.
NumPhysicalCores represents number of cores in our node.
RPS represents requests per second for a given server.
RPSLogical represents requests per second for a given server times number of logical CPU cores.
RPSPhysical represents requests per second for a given server times number of physical CPU cores.
StartTime represents initial time when we started the server.
Time0 represents initial time when we started the server.
TotalDeleteRequests counts total number of DELETE requests received by the server.
TotalGetRequests counts total number of GET requests received by the server.
TotalPostRequests counts total number of POST requests received by the server.
TotalPutRequests counts total number of PUT requests received by the server.
# Structs
CustomResponseWriter wraps gin.ResponseWriter to track response size.
GinRoute represents git route info.
Mem structure keeps track of virtual/swap memory of the server.
Memory structure keeps track of server memory.
Metrics provide various metrics about our server.
ProcFS represents prometheus profcs metrics.
RequestStats holds metrics related to number of requests on a server.
Route represents routes structure.
Templates structure.
# Type aliases
TmplRecord represent template record.