Tag: 远程服务器

使用nodejs将来自远程服务器的http请求redirect到本地服务器

在名为charles的工具中有一项function,可以让您映射远程请求: http://www.charlesproxy.com/documentation/tools/map-remote/ 基本上,它可以向服务器发送任何请求(即使不是运行它的服务器),然后向另一个服务器发出新的请求,保留path和查询string。 第二台服务器的响应会覆盖第一台服务器的响应。 我只是想知道是否有一个节点模块可以做到这一点。 我尝试使用HTTP代理,但我有一个感觉,这个地图远程工具是有点不同于代理,因为它看起来像你必须拥有一个代理服务器。 编辑:试图再次使用HTTP代理节点模块,但似乎无法得到它的工作。 这是我的代码: var http = require('http') , httpProxy = require('http-proxy'); httpProxy.createServer({ hostnameOnly: true, router: { 'www.stackoverflow.com': 'localhost:9000', } }).listen(80); // Create your target server // http.createServer(function (req, res) { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write('request successfully proxied!' + '\n' + JSON.stringify(req.headers, true, 2)); res.end(); }).listen(9000); 我的期望是,当我去www.stackoverflow.com或www.stackoverflow.com:80,它将redirect到我的本地主机:9000

我需要远程调用mongoexport并从node.js获得结果

我不知道如何去做这个,我需要导出一个.mvod集合.csv。 在节点中使用spawn.child_process调用mongoexport将完成此操作,但是我的mongodb服务器和节点服务器当前在单独的机器上。 如何从我的节点服务器远程调用mongo服务器上的mongoexport,然后将.csv发送到节点服务器?

上传文件到远程服务器使用multer sftp在express Node js?

我试图使用节点js中的multer-sftp将file upload到远程服务器。 因为我正在关注官方文档npm multer-sftp 。 以前我已经将file upload到Amazon S3而不是远程服务器。 现在我想上传文件到远程服务器。 API: exports.newFileUpload = function(req , res , next){ var storage = sftpStorage({ sftp: { host: 'http://www.port*****es.in/', port: 22, username: 'username', password: 'password' }, destination: function (req, file, cb) { cb(null, 'images/') }, filename: function (req, file, cb) { cb(null, file.fieldname + '-' + Date.now()) } }) […]