A curated list of browser globals that commonly cause confusion and are not recommended to use without an explicit window qualifier
Overall
score
97%
Build a development proxy configuration system for a React application that needs to communicate with multiple backend services during development while avoiding CORS issues.
Your application needs to proxy requests to two different backend services:
REST API Service: Running at http://localhost:5000
/api/* should be forwarded to this service/api prefix should be removed before forwarding (e.g., /api/users becomes /users on the backend)WebSocket Service: Running at ws://localhost:5001
/ws/* should be forwarded to this service/ws prefix should be removed before forwardingAdditionally, all proxied requests should have debug-level logging enabled to help with troubleshooting during development.
Create a file named setupProxy.js in the src/ directory that configures these proxy rules for the development server.
@generates
/api/users, it should be proxied to http://localhost:5000/users with the origin header changed @test/ws/chat, it should be proxied to ws://localhost:5001/chat @testProvides middleware for proxying HTTP and WebSocket requests in development.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-confusing-browser-globalsdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10