Removed echo-contrib dependency.

This commit is contained in:
mikestefanello 2024-06-15 16:56:47 -04:00
parent 8eafb6b666
commit 75aefa8a0a
13 changed files with 108 additions and 18 deletions

19
pkg/middleware/session.go Normal file
View file

@ -0,0 +1,19 @@
package middleware
import (
"github.com/gorilla/context"
"github.com/gorilla/sessions"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/pkg/session"
)
// Session sets the session storage in the request context
func Session(store sessions.Store) echo.MiddlewareFunc {
return func(next echo.HandlerFunc) echo.HandlerFunc {
return func(ctx echo.Context) error {
defer context.Clear(ctx.Request())
session.Store(ctx, store)
return next(ctx)
}
}
}