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.
19 lines
479 B
TypeScript
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 });
|
|
}
|
|
}
|