Skip to content

refactor(proxy): improve proxy factory implementation with lazy loading #97

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

Vincentdevreede
Copy link
Contributor

This PR refactors the proxy factory to lazy-load and cache module imports on first use, and introduces a safe default for missing proxy configuration.

Changes

  • Deferred require() calls for fast-proxy-lite, http-lambda-proxy, and fast-proxy until their branch is invoked
  • Cached each imported module in the closure to prevent redundant loads
  • Added route.proxyConfig || {} fallback
  • Replaced the if/else if/else proxyType checks with a switch(proxyType)

No functional changes—internal refactor only.

@Vincentdevreede Vincentdevreede changed the title Refactor/lazyload proxy factories refactor(proxy): improve proxy factory implementation with lazy loading May 7, 2025
Copy link
Collaborator

@jkyberneees jkyberneees left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR contain linting issues, please fix accordingly.

@jkyberneees jkyberneees merged commit 2f695e5 into BackendStack21:master May 10, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants