node.js http proxy middleware

علی ذوالفقار
1400/10/14 08:39:05 (558)
const express = require('express');
const { createProxyMiddleware } = require('http-proxy-middleware');

const app = express();
app.use('/remote/api', createProxyMiddleware({ 
    target: 'https://api.somesite.com/api/v1/data?param1=test¶m2=2021',
    headers: {
        accept: "application/json",
        method: "GET",
    },
    changeOrigin: true
}));
app.listen(3001);
Back