define-plugin.js 618 B

12345678910111213141516171819202122232425
  1. /**
  2. * Helper function to define a http-proxy-middleware plugin
  3. * @see proxyServer {@link ProxyServer} - proxy server instance to which the plugin is being applied
  4. * @see options {@link Options} - options object passed to `createProxyMiddleware`
  5. *
  6. * @example defining a plugin
  7. * ```js
  8. * export const myPlugin = definePlugin((proxyServer, options) => {
  9. * // plugin implementation
  10. * });
  11. * ```
  12. *
  13. * @example using a plugin
  14. * ```js
  15. * createProxyMiddleware({
  16. * target: 'http://example.com',
  17. * plugins: [myPlugin],
  18. * });
  19. * ```
  20. *
  21. * @since 4.1.0
  22. */
  23. export function definePlugin(fn) {
  24. return fn;
  25. }