From 3d317aa861a4c61596074909f7c7ad9d85751c35 Mon Sep 17 00:00:00 2001 From: Yongwoo Jung Date: Sun, 13 Feb 2022 14:26:03 +0900 Subject: [PATCH] docs(README.md): add description related to `externalResolver` option related: #21, #32 --- README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 82cdd63..e497bf3 100644 --- a/README.md +++ b/README.md @@ -59,13 +59,19 @@ This middleware is implemented using the [`http-proxy`](https://www.npmjs.com/pa #### Example -- Refer to the following for how to use Nextjs API Middleware +- Refer to the following for how to use Next.js API Middleware - [Next.js API Middlewares Guide](https://nextjs.org/docs/api-routes/api-middlewares) ```ts // pages/api/[...all].ts - ... + export const config = { + api: { + // Enabling the Next.js `externalResolver` setting + externalResolver: true, + }, + } + export default (req: NextApiRequest, res: NextApiResponse) => ( isDevelopment ? httpProxyMiddleware(req, res, { @@ -83,6 +89,10 @@ This middleware is implemented using the [`http-proxy`](https://www.npmjs.com/pa : res.status(404).send(null) ); ``` + - `externalResolver` is an explicit flag that tells the server that this route is being handled by an external resolver. Enabling this option disables warnings for unresolved requests. + - See the issues below + - https://github.com/stegano/next-http-proxy-middleware/issues/32 + - https://github.com/stegano/next-http-proxy-middleware/issues/21 #### Using `multipart/form-data` * If you are using the `multipart/form-data`, refer to the Issues below