kui-vault/06.Archive/aimSystems/선일다이파스 MMC 데모준비/Proxy with NodeJS Express.md

504 B

npm install express
npm isntall http-proxy-middleware
const express = require('express');
const { createProxyMiddleware } = require('http-proxy-middleware');

const app = express();
const PORT = 9005;

// "/api"로 시작하는 모든 요청을 다른 서버로 포워딩합니다.
app.use('*', createProxyMiddleware({ target: 'http://192.168.101.67:8080', changeOrigin: true }));

// 서버 시작
app.listen(PORT, () => {
  console.log(`Server is running on port ${PORT}`);
});