This is the default session object, that can be used in your application.
If you want to receive the Session object you can simply use this Session class as dependency injection token.
However, this will always create a new session (creating a session id + store it in the session storage).
If you simply want to check whether a session exists (user has a valid authenticaton token/cookie), use
SessionHandler.
If you need more fields, you can create your own Session class. Make sure to
annotate all fields using @t of @deepkit/type, since the whole object is serialized
in a session storage (either memory, local file system, or external databases like redis/mysql/etc).
This is the default session object, that can be used in your application.
If you want to receive the Session object you can simply use this Session class as dependency injection token. However, this will always create a new session (creating a session id + store it in the session storage). If you simply want to check whether a session exists (user has a valid authenticaton token/cookie), use SessionHandler.
If you need more fields, you can create your own Session class. Make sure to annotate all fields using
@t
of @deepkit/type, since the whole object is serialized in a session storage (either memory, local file system, or external databases like redis/mysql/etc).