提交 b46d6453 编写于 作者: Q qq_41923622

Mon Feb 10 13:44:00 CST 2025 inscode

上级 f965e771
const express = require('express');
const { createProxyMiddleware } = require('http-proxy-middleware');
const app = express();
const port = 3001;
// 目标服务器地址
const targetUrl = 'http://s.hunlihu.com';
// 创建代理中间件
const apiProxy = createProxyMiddleware('/', {
target: targetUrl,
changeOrigin: true,
pathRewrite: {
'^/': '' // 重写请求路径
}
});
// 使用代理中间件
app.use(apiProxy);
app.listen(port, () => {
console.log(`Server is running on port ${port}`);
});
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册