File size: 338 Bytes
c6b6c96
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
import { NextResponse } from 'next/server'
import { getEvents, getCount } from '@/lib/event-store'

export async function GET(req: Request) {
  const { searchParams } = new URL(req.url)
  const limit = Math.min(parseInt(searchParams.get('limit') || '20'), 50)
  return NextResponse.json({ events: getEvents(limit), total: getCount() })
}