import { NextRequest, NextResponse } from "next/server"; import { SESSION_COOKIE } from "../../../../lib/auth/session"; import { ok } from "../../../../lib/http"; export const runtime = "nodejs"; export async function POST(req: NextRequest) { console.log("[LOGOUT] User logout"); const res = ok({ message: "Logged out successfully" }); // Clear the session cookie res.cookies.set(SESSION_COOKIE, "", { httpOnly: true, sameSite: "lax", secure: process.env.NODE_ENV === "production", path: "/", maxAge: 0, }); console.log("[LOGOUT] Session cleared"); return res; }