Initial commit.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
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
|
||||
Reference in New Issue
Block a user