Skip to content

Commit

Permalink
fix: fixed es imports
Browse files Browse the repository at this point in the history
  • Loading branch information
BowlingX committed May 29, 2024
1 parent 2e12a1e commit fb0a5f1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/createProxyCacheMiddleware.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { hasDirectives } from 'apollo-utilities'
import * as bp from 'body-parser'
import bp from 'body-parser'
import type { Request, Response, NextFunction, RequestHandler } from 'express'
import { DocumentNode, parse, print } from 'graphql'
import {
Expand All @@ -21,6 +21,8 @@ const CACHE_HEADER = 'X-Proxy-Cached'

type RequestWithCache = Request & { _hasCache: { id: string; timeout: number } }

const { json } = bp

const middlewareToPromise =
(middleware: RequestHandler) =>
(req: Parameters<RequestHandler>[0], res: Parameters<RequestHandler>[1]) => {
Expand All @@ -30,7 +32,7 @@ const middlewareToPromise =
})
}

const jsonBodyParserPromise = middlewareToPromise(bp.json())
const jsonBodyParserPromise = middlewareToPromise(json())

export const createProxyCacheMiddleware =
<T extends Cache<string, any>>(
Expand Down

0 comments on commit fb0a5f1

Please sign in to comment.