Tag: 发布

在互联网上发布Node.JS服务器

我有一个Node.JS服务器,在localhost上正常工作。 现在我想从我的机器托pipe的互联网上访问。 我公开的IP地址( Google告诉我的那个IP地址)似乎不是“可访问的”: https.createServer({ key: privateKey, cert: certificate }, server).listen(80, '86.151.23.17'); 以下Node.JS错误失败: Error: listen EADDRNOTAVAIL at errnoException (net.js:770:11) at Server._listen2 (net.js:893:19) at listen (net.js:937:10) at Server.listen (net.js:994:9) at dns.js:71:18 at process.startup.processNextTick.process._tickCallback (node.js:244:9) 如何将我的Node.JS服务器发布到我的公共IP地址? [注:我没有其他的networking服务器运行。 另外,我已经尝试了各种不同的端口,如这里所build议的。]

在Node.js中使用axios发布表单数据

我正在testingPostman上的Uber API,并且能够成功发送带有表单数据的请求。 当我尝试使用Node.js和axios库翻译这个请求时,我得到一个错误。 这是我的邮差请求的样子: 我得到的回应是: { "error": "invalid_client" } 以下是我在Node.js和axios中所做的: var axios = require("axios"); const config = { headers: { 'Content-Type': 'multipart/form-data' } }; axios.post('https://login.uber.com/oauth/v2/token', { client_id: '***', client_secret: '***', grant_type: 'authorization_code', redirect_uri: 'http://localhost:8080/', code: '***' }, config) .then(function(response) { console.log(response.data) }) .catch(function(error) { console.log(error) }) 当我这样做,我得到一个400响应。 我添加了'multipart/form-data'标题,因为我填写了邮递员请求中的表单数据。 没有头我得到相同的结果。 我期望得到我从邮差得到的相同的响应,有没有在我的configurationvariables在Node.js脚本错了吗? 任何帮助,将不胜感激!

用蓝鸟实现request.postAsync承诺

我正在使用bluebird promises框架来发出POST请求并获得对该POST请求的响应: var Promise = require('bluebird'); var request = Promise.promisifyAll(require('request')); // Set the headers var headers = { 'User-Agent': 'Super Agent/0.0.1', 'Content-Type': 'application/x-www-form-urlencoded' } var options = []; var scores = []; // Configure the request options[0] = { url: 'https://api.havenondemand.com/1/api/sync/analyzesentiment/v1', method: 'POST', headers: headers, form: {'apikey': 'XXXXXXXXXXX', 'text': 'I love dogs'} } // Start […]

实际上排除文件发布没有validation它

我试图发布一个纯粹的客户端项目 – 这是 – 纯html / js / css文件,在开发过程中由nodejspipe理。 节点创build一个非常深的path(超过260个字符) – 在node_modules / …内 尽pipe我完全排除了node_modules: <ExcludeFoldersFromDeployment>test;node_modules</ExcludeFoldersFromDeployment> 我尝试发布时仍然会引发exception: Error 1 The "CollectFilesinFolder" task failed unexpectedly. System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 […]