cal.pub0.org/lib/helpers/withMiddleware.ts

19 lines
573 B
TypeScript
Raw Normal View History

import { label } from "next-api-middleware";
import { addRequestId } from "./addRequestid";
import { captureErrors } from "./captureErrors";
import { verifyApiKey } from "./verifyApiKey";
import { postOnly, deleteOnly, patchOnly, getOnly } from "./httpMethods";
const withMiddleware = label(
{
getOnly,
patchOnly,
postOnly,
deleteOnly,
addRequestId,
verifyApiKey,
sentry: captureErrors, // <-- Optionally alias middleware
},
["sentry","verifyApiKey"] // <-- Provide a list of middleware to call automatically
);
2022-03-29 01:23:22 +00:00
export { withMiddleware };