Yo! I had this exact problem last week. You can use `http-proxy-middleware` like you mentioned. The key is the `pathRewrite` option. Here’s how I did it:
```javascript
const proxy = require('http-proxy-middleware');
app.use('/api', proxy({
target: 'http://your-target-server.com',
pathRewrite: { '^/api/v1': '/v2' }
}));
```
This will map `/api/v1/users` to `/v2/users`. Super clean and easy to implement. Hope this helps!
```javascript
const proxy = require('http-proxy-middleware');
app.use('/api', proxy({
target: 'http://your-target-server.com',
pathRewrite: { '^/api/v1': '/v2' }
}));
```
This will map `/api/v1/users` to `/v2/users`. Super clean and easy to implement. Hope this helps!
