Skip to main content
Faremeter API
Faremeter API / middleware/src / express

express

Functions

createMiddleware()

createMiddleware(args): Promise<(req, res, next) => Promise<undefined | Response<any, Record<string, any>>>>
Defined in: packages/middleware/src/express.ts:21 Creates Express middleware that gates routes behind x402 payment. The middleware intercepts requests, checks for payment headers, communicates with the facilitator to validate and settle payments, and only allows the request to proceed if payment is successful.

Parameters

args
CommonMiddlewareArgs Configuration including facilitator URL and accepted payment types

Returns

Promise<(req, res, next) => Promise<undefined | Response<any, Record<string, any>>>> An Express middleware function