Documentation
¶
Overview ¶
Copyright © 2024-2025 Thomas von Dein
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
This logging middleware is based on
https://github.com/elithrar/admission-control/blob/v0.6.3/request_logger.go
by Matt Silverlock licensed under the Apache-2.0 license. I am using slog and added a couple of small modifications.
Copyright © 2024-2025 Thomas von Dein ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- func Home(resp http.ResponseWriter)
- func JsonStatus(resp http.ResponseWriter, code int, msg string)
- func LogHandler() func(http.Handler) http.Handler
- func RestDelete(resp http.ResponseWriter, req *http.Request, key string, conf *cfg.Config)
- func RestGet(resp http.ResponseWriter, req *http.Request, key string, conf *cfg.Config)
- func RestList(resp http.ResponseWriter, req *http.Request, conf *cfg.Config)
- func RestSet(resp http.ResponseWriter, req *http.Request, conf *cfg.Config)
- func Runserver(conf *cfg.Config, args []string) error
- type ListResponse
- type Result
- type SetContext
- type SingleResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Home ¶
func Home(resp http.ResponseWriter)
func JsonStatus ¶
func JsonStatus(resp http.ResponseWriter, code int, msg string)
Wrapper to respond with proper json status, message and code, shall be prepared and called by the handlers directly.
func LogHandler ¶
LoggingMiddleware logs the incoming HTTP request & its duration.
func RestDelete ¶
Types ¶
type Result ¶
type Result struct {
Success bool `json:"success"`
Message string `json:"message"`
Code int `json:"code"`
}
used to return to the api client
type SetContext ¶
type SetContext struct {
Query string `json:"query" form:"query"`
}