26 lines
618 B
JavaScript
26 lines
618 B
JavaScript
|
|
/**
|
||
|
|
* 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 function definePlugin(fn) {
|
||
|
|
return fn;
|
||
|
|
}
|