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 Express-based API proxy server that forwards POST requests to a backend service while properly handling request bodies that have been parsed by body-parser middleware.
Many Express applications use body-parser middleware to parse incoming request bodies for easy access in route handlers. However, when you want to proxy these requests to a backend service, the request stream has already been consumed by body-parser, which can cause issues. Your task is to build a proxy server that correctly handles this scenario.
Your server should:
/api/data endpoint with JSON payloads/api/form endpoint with URL-encoded form data@generates
/**
* Express server that proxies POST requests to a backend service.
* The server should listen on port 3000.
*
* Routes:
* - POST /api/data - Accepts JSON payloads, proxies to backend
* - POST /api/form - Accepts URL-encoded form data, proxies to backend
*//api/data with {"name": "test", "value": 123} and forwards it to the backend @test/api/form with field1=value1&field2=value2 and forwards it to the backend @testProvides proxy middleware functionality for Express, including request body reconstruction.
Web application framework for Node.js.
Middleware to parse request bodies in Express applications.
docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10