diff --git a/api/api.go b/api/api.go index c5c1899..50dbceb 100644 --- a/api/api.go +++ b/api/api.go @@ -3,11 +3,8 @@ package api import ( "git.lumeweb.com/LumeWeb/portal/interfaces" "github.com/julienschmidt/httprouter" - "go.sia.tech/jape" ) -type MiddlewareFunc func(jape.Handler) jape.Handler - func Init(router interfaces.APIRegistry) error { router.Register("s5", NewS5()) return nil diff --git a/api/middleware/util.go b/api/middleware/util.go index 80a2783..2dcc28c 100644 --- a/api/middleware/util.go +++ b/api/middleware/util.go @@ -1,11 +1,12 @@ package middleware import ( - "git.lumeweb.com/LumeWeb/portal/api" "go.sia.tech/jape" ) -func ApplyMiddlewares(handler jape.Handler, middlewares ...api.MiddlewareFunc) jape.Handler { +type MiddlewareFunc func(jape.Handler) jape.Handler + +func ApplyMiddlewares(handler jape.Handler, middlewares ...MiddlewareFunc) jape.Handler { // Apply each middleware in reverse order for i := len(middlewares) - 1; i >= 0; i-- { handler = middlewares[i](handler)