The one-liner node.js proxy middleware for connect, express, next.js and more
92
Pending
Does it follow best practices?
Impact
92%
1.24xAverage score across 10 eval scenarios
Pending
The risk profile of this skill
Build a simple API gateway server that forwards incoming requests to different backend services based on the request path.
Your server should:
/api/users to http://localhost:4001/api/products to http://localhost:4002Provides web server framework.
Provides HTTP/HTTPS proxy middleware functionality.
File: src/server.test.js
Test: When a GET request is made to /api/users/123, it should be forwarded to http://localhost:4001/api/users/123.
Setup: Start a mock backend server on port 4001 that responds with {"service": "users"} for any request.
Expected: The response should be {"service": "users"} with status code 200.
File: src/server.test.js
Test: When a GET request is made to /api/products/456, it should be forwarded to http://localhost:4002/api/products/456.
Setup: Start a mock backend server on port 4002 that responds with {"service": "products"} for any request.
Expected: The response should be {"service": "products"} with status code 200.
File: src/server.test.js
Test: When a GET request is made to /api/users/123 but the backend service is not running, it should return an error response.
Setup: Ensure no server is running on port 4001.
Expected: The response should have a 5xx status code (500, 502, or 504).
docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10