mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
wrapping some agent components.
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
import {NextResponse} from "next/server";
|
||||
|
||||
export const errorHandler = (error: any) => {
|
||||
return new NextResponse(
|
||||
JSON.stringify({ message: 'An error occurred while processing your request.', status: 500 }),
|
||||
{ status: 500, headers: { 'Content-Type': 'application/json' } }
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
export function loggingMiddleware(request: NextRequest) {
|
||||
if (request.url.includes('/api')) {
|
||||
console.log(`[API] Received ${request.method} request : ${request.url} at ${new Date()}`);
|
||||
}
|
||||
return NextResponse.next();
|
||||
}
|
||||
Reference in New Issue
Block a user