Files
myeasycms-v2/apps/web/app/api/db/webhook/route.ts
giancarlo 14dee4f347 Refactor webhook handler service and update dependencies
Refactor to make database webhook handler service a function. This change introduces the function `getDatabaseWebhookHandlerService()` to return an instance of the service, allowing easier management of instances. Dependencies are updated as well, including bringing `react-i18next` to version 14.1.1(i18next@23.11.3) and `@react-email/components` to version 0.0.17 and others.
2024-04-30 02:36:48 +07:00

19 lines
479 B
TypeScript

import { getDatabaseWebhookHandlerService } from '@kit/database-webhooks';
/**
* @name POST
* @description POST handler for the webhook route that handles the webhook event
*/
export async function POST(request: Request) {
const service = getDatabaseWebhookHandlerService();
try {
// handle the webhook event
await service.handleWebhook(request);
return new Response(null, { status: 200 });
} catch {
return new Response(null, { status: 500 });
}
}