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:
38
mailgun-webhook/jest.config.ts
Normal file
38
mailgun-webhook/jest.config.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
/** @type {import('jest/dist/types').InitialOptionsTsJest} */
|
||||
|
||||
import type { Config } from 'jest/build/index';
|
||||
|
||||
const config:Config = {
|
||||
// preset: 'ts-jest',
|
||||
transform: {
|
||||
'^.+\\.tsx?$': [
|
||||
'esbuild-jest', {
|
||||
sourcemap:true, // bez ovog VS code umjesto originala prikazuje transpilirane datoteke
|
||||
target:'es2020' // ovo je nužno kako bi BigInt funkcionirao
|
||||
}]
|
||||
},
|
||||
maxWorkers: 4,
|
||||
testEnvironment: 'node',
|
||||
moduleNameMapper: {
|
||||
},
|
||||
// The root directory that Jest should scan for tests and modules within
|
||||
rootDir: "./",
|
||||
// A list of paths to directories that Jest should use to search for files in
|
||||
roots: [
|
||||
"<rootDir>/tests",
|
||||
],
|
||||
// The glob patterns Jest uses to detect test files
|
||||
testMatch: [
|
||||
"**/?(*.)+(spec).[tj]s?(x)",
|
||||
],
|
||||
// Automatically clear mock calls and instances between every test
|
||||
clearMocks: true,
|
||||
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
|
||||
transformIgnorePatterns: ["/node_modules/"],
|
||||
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
|
||||
testPathIgnorePatterns: ["/node_modules/", "/build/"],
|
||||
// Indicates whether each individual test should be reported during the run
|
||||
verbose: true,
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
Reference in New Issue
Block a user