ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
node作为中间层并不需要处理所有api请求,api转发代码如下: ` if (pathname.includes("/api") || pathData.includes(pathname)) { // 转发htp请求 console.log(pathname, req.method); try { if (/GET/i.test(req.method)) { req.pipe(request.get(URL + req.url)).pipe(res); } else if (/POST|PUT/i.test(req.method)) { req.pipe(request.post(URL + req.url, { form: req.body })).pipe(res); } } catch (error) { console.log(error); res.end(`{err:${error}}`); } }