@shopify/shopify-app-express
Version:
Shopify Express Middleware - to simplify the building of Shopify Apps with Express
23 lines (19 loc) • 504 B
text/typescript
import {WebhookProcessParams} from './types';
export async function process({
req,
res,
api,
config,
}: WebhookProcessParams): Promise<void> {
try {
await api.webhooks.process({
rawBody: req.body,
rawRequest: req,
rawResponse: res,
});
config.logger.info('Webhook processed, returned status code 200');
} catch (error) {
config.logger.error(`Failed to process webhook: ${error}`);
// The library will respond even if the handler throws an error
}
}