import { createApplication } from '@setu-ts/kernel';import { RuntimePlugin } from '@setu-ts/runtime';import { getSession, SessionPlugin } from '@setu-ts/session-plugin';const app = createApplication({ plugins: [RuntimePlugin(), SessionPlugin({ secret: mySecret, csrf: {} })],});app.router.get('/me', (ctx) => { const session = getSession(ctx); return ctx.response.json({ userId: session.get<string>('userId') ?? null });}); Copy
import { createApplication } from '@setu-ts/kernel';import { RuntimePlugin } from '@setu-ts/runtime';import { getSession, SessionPlugin } from '@setu-ts/session-plugin';const app = createApplication({ plugins: [RuntimePlugin(), SessionPlugin({ secret: mySecret, csrf: {} })],});app.router.get('/me', (ctx) => { const session = getSession(ctx); return ctx.response.json({ userId: session.get<string>('userId') ?? null });});
Example