feat: implement MailGun webhook service for logging email events
Implemented a production-ready TypeScript/Express.js service to receive and log MailGun webhook events (delivered, failed, opened, clicked, etc.). Key features: - Webhook endpoint (POST /webhook) with comprehensive event logging - Full TypeScript type definitions for all MailGun event types - Prometheus metrics integration for monitoring - Health check endpoint (GET /ping) - Comprehensive Jest test suite with 87.76% coverage - Docker containerization with build scripts Removed template/example code: - All SQL/MSSQL dependencies and related code - Example auth router and middleware - PRTG metrics support (simplified to Prometheus only) - Unused middleware (CORS, IP whitelist, request parsing/validation) - Template documentation (kept only MailGun webhook API spec) The service is clean, minimal, and focused solely on receiving and logging MailGun webhook events to the console. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
29
mailgun-webhook/tests/__mocks__/prom-client.ts
Normal file
29
mailgun-webhook/tests/__mocks__/prom-client.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { LabelValues } from "prom-client";
|
||||
|
||||
export class Counter {
|
||||
public inc() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export class Histogram<T extends string> {
|
||||
startTimer(labels?: LabelValues<T>): (labels?: LabelValues<T>) => void {
|
||||
return((labels?: LabelValues<T>) => { });
|
||||
}
|
||||
}
|
||||
|
||||
class Register {
|
||||
public setDefaultLabels(labels: Object) {
|
||||
|
||||
}
|
||||
|
||||
public metrics(): Promise<string> {
|
||||
return(Promise.resolve(""));
|
||||
}
|
||||
|
||||
public get contentType() {
|
||||
return("");
|
||||
}
|
||||
}
|
||||
|
||||
export const register = new Register();
|
||||
Reference in New Issue
Block a user