| 12345678910111213141516171819202122232425 |
- import type * as http from 'node:http';
- import type { Plugin } from '../types.js';
- /**
- * Helper function to define a http-proxy-middleware plugin
- * @see proxyServer {@link ProxyServer} - proxy server instance to which the plugin is being applied
- * @see options {@link Options} - options object passed to `createProxyMiddleware`
- *
- * @example defining a plugin
- * ```js
- * export const myPlugin = definePlugin((proxyServer, options) => {
- * // plugin implementation
- * });
- * ```
- *
- * @example using a plugin
- * ```js
- * createProxyMiddleware({
- * target: 'http://example.com',
- * plugins: [myPlugin],
- * });
- * ```
- *
- * @since 4.1.0
- */
- export declare function definePlugin<TReq extends http.IncomingMessage = http.IncomingMessage, TRes extends http.ServerResponse = http.ServerResponse>(fn: Plugin<TReq, TRes>): Plugin<TReq, TRes>;
|