Neah/app/api/mail/route.ts
2025-04-26 09:14:44 +02:00

22 lines
700 B
TypeScript

import { NextResponse } from 'next/server';
/**
* This route is deprecated. It redirects to the new courrier API endpoint.
* @deprecated Use the /api/courrier endpoint instead
*/
export async function GET(request: Request) {
console.warn('Deprecated: /api/mail route is being used. Update your code to use /api/courrier instead.');
// Extract query parameters
const url = new URL(request.url);
// Redirect to the new API endpoint
const redirectUrl = new URL('/api/courrier', url.origin);
// Copy all search parameters
url.searchParams.forEach((value, key) => {
redirectUrl.searchParams.set(key, value);
});
return NextResponse.redirect(redirectUrl.toString());
}