Added a basic homepage

This commit is contained in:
CamZawacki 2026-05-20 16:09:54 +01:00
parent d40640a648
commit 12fd3c04ca
113 changed files with 414 additions and 506 deletions

View file

@ -0,0 +1,27 @@
package session
import (
"errors"
"github.com/gorilla/sessions"
"github.com/labstack/echo/v4"
"github.com/camzawacki/personal-site/internal/context"
)
// ErrStoreNotFound indicates that the session store was not present in the context
var ErrStoreNotFound = errors.New("session store not found")
// Get returns a session
func Get(ctx echo.Context, name string) (*sessions.Session, error) {
s := ctx.Get(context.SessionKey)
if s == nil {
return nil, ErrStoreNotFound
}
store := s.(sessions.Store)
return store.Get(ctx.Request(), name)
}
// Store sets the session storage in the context
func Store(ctx echo.Context, store sessions.Store) {
ctx.Set(context.SessionKey, store)
}