Skip to main content
Glama
route.ts624 B
// app/api/todos/route.ts import { NextRequest, NextResponse } from "next/server"; import { listTodos, addTodo } from "../../../../lib/todos"; export const runtime = "nodejs"; export const dynamic = "force-dynamic"; export async function GET() { const todos = await listTodos(); return NextResponse.json(todos); } export async function POST(req: NextRequest) { const { title, due } = await req.json(); if (!title || typeof title !== "string") { return NextResponse.json({ error: "title required" }, { status: 400 }); } const t = await addTodo(title, due); return NextResponse.json(t, { status: 201 }); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Havfar/Todo-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server