mirror of
https://github.com/documenso/documenso.git
synced 2025-11-14 08:42:12 +10:00
18 lines
550 B
TypeScript
18 lines
550 B
TypeScript
import { Hono } from 'hono';
|
|
import superjson from 'superjson';
|
|
|
|
import type { SessionValidationResult } from '../lib/session/session';
|
|
import { getOptionalSession } from '../lib/utils/get-session';
|
|
|
|
export const sessionRoute = new Hono()
|
|
.get('/session', async (c) => {
|
|
const session: SessionValidationResult = await getOptionalSession(c);
|
|
|
|
return c.json(session);
|
|
})
|
|
.get('/session-json', async (c) => {
|
|
const session: SessionValidationResult = await getOptionalSession(c);
|
|
|
|
return c.json(superjson.serialize(session));
|
|
});
|