diff --git a/src/middlewares/withMiddleware.js b/src/middlewares/withMiddleware.js deleted file mode 100644 index ce50ce6a..00000000 --- a/src/middlewares/withMiddleware.js +++ /dev/null @@ -1,3 +0,0 @@ -import { withCollection } from './withCollection' - -export const withMiddleware = handler => withCollection(handler) diff --git a/src/middlewares/withMiddleware.ts b/src/middlewares/withMiddleware.ts new file mode 100644 index 00000000..c3b4f758 --- /dev/null +++ b/src/middlewares/withMiddleware.ts @@ -0,0 +1,6 @@ +import { withCollection } from './withCollection' +import { NextApiRequest, NextApiResponse } from 'next' + +export type Handler = (req: NextApiRequest, res: NextApiResponse) => void + +export const withMiddleware = (handler: Handler) => withCollection(handler)