|
1 |
| -import { NextApiResponse, NextApiRequest } from "next"; |
2 |
| -import { ServerOptions } from "http-proxy"; |
3 |
| -export interface NextHttpProxyMiddlewareOptions extends ServerOptions { |
4 |
| - pathRewrite?: { |
5 |
| - [key: string]: string; |
6 |
| - }; |
7 |
| -} |
8 |
| -/** |
9 |
| - * If a key pattern is found in `pathRewrite` that matches the url value, |
10 |
| - * replace matched string of url with the `pathRewrite` value. |
11 |
| - * @param req |
12 |
| - * @param pathRewrite |
13 |
| - */ |
14 |
| -export declare const rewritePath: (url: string, pathRewrite: { |
15 |
| - [key: string]: string; |
16 |
| -}) => string; |
17 |
| -/** |
18 |
| - * Next.js HTTP Proxy Middleware |
19 |
| - * @see https://nextjs.org/docs/api-routes/api-middlewares |
20 |
| - * @param {NextApiRequest} req |
21 |
| - * @param {NextApiResponse} res |
22 |
| - * @param {NextHttpProxyMiddlewareOptions} httpProxyOptions |
23 |
| - */ |
24 |
| -declare const httpProxyMiddleware: (req: NextApiRequest, res: NextApiResponse<any>, httpProxyOptions?: NextHttpProxyMiddlewareOptions) => Promise<any>; |
25 |
| -export default httpProxyMiddleware; |
| 1 | +import { NextApiResponse, NextApiRequest } from "next"; |
| 2 | +import { ServerOptions } from "http-proxy"; |
| 3 | +export interface NextHttpProxyMiddlewareOptions extends ServerOptions { |
| 4 | + pathRewrite?: { |
| 5 | + [key: string]: string; |
| 6 | + }; |
| 7 | +} |
| 8 | +/** |
| 9 | + * If a key pattern is found in `pathRewrite` that matches the url value, |
| 10 | + * replace matched string of url with the `pathRewrite` value. |
| 11 | + * @param req |
| 12 | + * @param pathRewrite |
| 13 | + */ |
| 14 | +export declare const rewritePath: (url: string, pathRewrite: { |
| 15 | + [key: string]: string; |
| 16 | +}) => string; |
| 17 | +/** |
| 18 | + * Next.js HTTP Proxy Middleware |
| 19 | + * @see https://nextjs.org/docs/api-routes/api-middlewares |
| 20 | + * @param {NextApiRequest} req |
| 21 | + * @param {NextApiResponse} res |
| 22 | + * @param {NextHttpProxyMiddlewareOptions} httpProxyOptions |
| 23 | + */ |
| 24 | +declare const httpProxyMiddleware: (req: NextApiRequest, res: NextApiResponse<any>, httpProxyOptions?: NextHttpProxyMiddlewareOptions) => Promise<any>; |
| 25 | +export default httpProxyMiddleware; |
0 commit comments