http-proxy-middleware
Version:
The one-liner node.js proxy middleware for connect, express, next.js and more
26 lines (25 loc) • 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;
}