Refactor server package structure and update error handling methods; remove unused dependencies

This commit is contained in:
alex
2025-06-22 11:54:16 +03:00
parent eaff815270
commit 0d8673254e
9 changed files with 32 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
package server_v1
package v1
import (
"log/slog"
@@ -12,7 +12,9 @@ type ServerV1UtilsContract interface {
extractDescriptionStatic(path string) (string, error)
writeJSONError(status int, msg string)
newUUID() string
errNotFound()
_errNotFound()
ErrNotFound(w http.ResponseWriter, r *http.Request)
}
type ServerV1Contract interface {
@@ -37,6 +39,10 @@ type HandlerV1 struct {
listAllowedCmd *regexp.Regexp
}
func InitV1Server(o *HandlerV1) *HandlerV1 {
return o
}
func (h *HandlerV1) Handle(w http.ResponseWriter, r *http.Request) {
h.w = w
h.r = r