refactor: fix import cycles
This commit is contained in:
parent
1f7c05434a
commit
60c7cc5c6c
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue