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 middleware-based request router that selectively forwards API requests to different backend services based on URL patterns.
Your task is to create an Express server that acts as a gateway, forwarding specific API requests to a backend service while letting other requests pass through normally.
The server should:
/api/users/** to a backend service at http://localhost:4000/api/data/*.json to the same backend service/api/users/health (this should be excluded from proxying)All other requests (not matching the patterns above) should return a 404 response with the message "Not Found".
/api/users/123 is forwarded to the backend @test/api/data/report.json is forwarded to the backend @test/api/users/health is not forwarded and returns 404 @test/other is not forwarded and returns 404 @test@generates
/**
* Creates and returns an Express application configured with proxy middleware.
* The app should be ready to listen on a port.
*
* @returns {Express.Application} Configured Express application
*/
function createApp() {
// Implementation
}
module.exports = { createApp };Provides web server framework.
@satisfied-by
Provides proxy middleware functionality.
@satisfied-by
docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10