Files
bunker/server/internal/services/core/httpserver.go
Stanislav N. aka pztrn f1617efb0f
All checks were successful
Linting and tests / Linting (push) Successful in 5s
HTTP server with WebSockets.
2025-09-20 09:59:09 +05:00

24 lines
783 B
Go

package core
import (
"errors"
"net/http"
)
// ServiceNameHTTPServer is a name for HTTP server service.
const ServiceNameHTTPServer = "core/http_server"
// ErrHTTPServerIsInvalid appears when HTTP server service implementation is invalid.
var ErrHTTPServerIsInvalid = errors.New("HTTP server service implementation is invalid")
// HTTPServer is an interface for HTTP server service.
type HTTPServer interface {
// RegisterHandler registers HTTP handler.
RegisterHandler(method, path string, handler http.HandlerFunc)
// RegisterMiddleware registers HTTP server middlewares.
RegisterMiddleware(middleware HTTPMiddlewareFunc)
}
// HTTPMiddlewareFunc is a function that acts as middleware for HTTP requests.
type HTTPMiddlewareFunc func(fn http.HandlerFunc) http.HandlerFunc