refactor: fix import cycles

This commit is contained in:
Derrick Hammer 2024-01-19 17:12:26 -05:00
parent 1f7c05434a
commit 60c7cc5c6c
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 3 additions and 5 deletions

View File

@ -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

View File

@ -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)