import { getSession } from '../store'; export async function GET(req: Request) { try { const url = new URL(req.url); const parts = url.pathname.split('/'); const id = parts[parts.length - 1] || ''; if (!id) return new Response(JSON.stringify({ error: 'missing id' }), { status: 400, headers: { 'content-type': 'application/json' } }); const sess = getSession(id); if (!sess) return new Response(JSON.stringify({ error: 'not found' }), { status: 404, headers: { 'content-type': 'application/json' } }); return new Response(JSON.stringify(sess), { status: 200, headers: { 'content-type': 'application/json' } }); } catch (err) { console.error('Error in GET /api/session/:id', err); return new Response(JSON.stringify({ error: 'internal' }), { status: 500, headers: { 'content-type': 'application/json' } }); } }