17 lines
416 B
TypeScript
17 lines
416 B
TypeScript
import { NextResponse } from 'next/server'
|
|
import { fetchAllTodos } from '@/lib/notion-pm'
|
|
|
|
export const revalidate = 300
|
|
|
|
export async function GET() {
|
|
try {
|
|
const todos = await fetchAllTodos()
|
|
return NextResponse.json({
|
|
todos,
|
|
timestamp: new Date().toISOString(),
|
|
count: todos.length,
|
|
})
|
|
} catch (err) {
|
|
return NextResponse.json({ error: String(err) }, { status: 500 })
|
|
}
|
|
}
|