Faremeter API / middleware/src / express
express
Functions
createMiddleware()
createMiddleware(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.args):Promise<(req,res,next) =>Promise<undefined|Response<any,Record<string,any>>>>
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