ekzyis 92876c5011 users, sessions and wallets w/o authentication
* if a request has no session cookie, a new user, session and wallet is created and session cookie is set
* if a request has a session cookie and session exists in db, we will fetch user and wallet from db
* this means that we have a user and wallet during each render without any login required
2024-12-15 21:56:26 +01:00

21 lines
502 B
Go

package router
import (
"github.com/ekzyis/magicwallet/pages"
"github.com/ekzyis/magicwallet/server/router/context"
"github.com/ekzyis/magicwallet/server/router/middleware"
"github.com/labstack/echo/v4"
)
type Context = context.Context
func Handle(e *echo.Echo, hc Context) {
e.GET("/", HandleIndex(hc), middleware.Session(hc))
}
func HandleIndex(hc Context) echo.HandlerFunc {
return func(ec echo.Context) error {
return pages.Index().Render(hc.WithContext(ec), ec.Response().Writer)
}
}