import getDb , { DB } from './get-db' ; import { NextApiMiddleware } from '@api/shared/shared.types' ; declare module 'next' { interface NextApiRequest { db : DB ; } } const withDb = ( fn ) => ( req , res ) => { const db = getDb ( ) ; req . db = db ; return fn ( req , res ) ; } ; export default withDb ;