EverydayTech Platform - Developer Reference
Complete Source Code Documentation - All Applications
Loading...
Searching...
No Matches
route.ts
Go to the documentation of this file.
1import { NextRequest, NextResponse } from 'next/server';
2import { cookies } from 'next/headers';
3
4export async function POST(request: NextRequest) {
5 try {
6 const cookieStore = await cookies();
7
8 // Clear the session cookie
9 cookieStore.delete('fieldpine-session');
10
11 return NextResponse.json({
12 success: true,
13 message: 'Logged out successfully'
14 });
15
16 } catch (error) {
17 console.error('Logout API error:', error);
18 return NextResponse.json(
19 { error: 'Internal server error' },
20 { status: 500 }
21 );
22 }
23}