草庐IT

Localhost

全部标签

javascript - 将 cookie 作为 node.js 请求的一部分传递

我正在使用request包来创建我的服务器端请求。我编写了身份验证中间件,用于检查所有请求的cookie/sessionID。因此,有没有办法将用户的cookie作为请求的一部分包含在内?这是我当前的代码:varcookie=parseCookie.parseCookie(req.headers.cookie);request('http://localhost:3000/users/api',function(error,response,body){console.log(body);//thisconsole.logsmyloginpagesincerequestsw/ovali

node.js - 是否可以从 vagrant devbox 访问本地主机?

我正在我的计算机上的本地VagrantVM上运行我的应用程序,我想知道我是否创建了一个在本地主机上运行的Node服务器(也在我的计算机上)我是否能够从我的Vagrant应用程序访问Node服务器? 最佳答案 使用默认的vagrant设置,您可以通过IP10.0.2.2访问您的主机。至少对于VirtualBox提供者来说是这样。到目前为止我还没有测试过其他人。如果您已在主机上配置Node服务器,使其监听分配给主机的所有IP地址,您应该能够访问http://10.0.2.2来自vagrant虚拟机。

node.js - 是否可以从 vagrant devbox 访问本地主机?

我正在我的计算机上的本地VagrantVM上运行我的应用程序,我想知道我是否创建了一个在本地主机上运行的Node服务器(也在我的计算机上)我是否能够从我的Vagrant应用程序访问Node服务器? 最佳答案 使用默认的vagrant设置,您可以通过IP10.0.2.2访问您的主机。至少对于VirtualBox提供者来说是这样。到目前为止我还没有测试过其他人。如果您已在主机上配置Node服务器,使其监听分配给主机的所有IP地址,您应该能够访问http://10.0.2.2来自vagrant虚拟机。

javascript - 将 node js 和 socket IO 与 codeigniter 集成

如何在代码点火器中集成node.js和套接字IO。//createanewwebsocketvarsocket=io.connect('http://localhost:8000');//onmessagereceivedweprintallthedatainsidethe#containerdivsocket.on('notification',function(data){varusersList="";$.each(data.users,function(index,user){usersList+=""+user.user_name+"\n"+""+user.user_desc

javascript - 将 node js 和 socket IO 与 codeigniter 集成

如何在代码点火器中集成node.js和套接字IO。//createanewwebsocketvarsocket=io.connect('http://localhost:8000');//onmessagereceivedweprintallthedatainsidethe#containerdivsocket.on('notification',function(data){varusersList="";$.each(data.users,function(index,user){usersList+=""+user.user_name+"\n"+""+user.user_desc

node.js - 通过 localhost :port on virtual machine 访问 node.js/grunt 服务器

我正在通过Grunt在端口9000上本地运行node.js服务器。我也有一个正在运行的虚拟机(vmware),但我无法通过它访问Node服务器。我已经将VM配置为通过localhost访问主机上的Apache服务器,但:9000给出“未找到”。有人知道怎么做吗? 最佳答案 知道了!在我项目的Grunt.js文件中有这样的设置:grunt.initConfig({...connect:{options:{port:9000,//Changethisto'0.0.0.0'toaccesstheserverfromoutside.host

node.js - 通过 localhost :port on virtual machine 访问 node.js/grunt 服务器

我正在通过Grunt在端口9000上本地运行node.js服务器。我也有一个正在运行的虚拟机(vmware),但我无法通过它访问Node服务器。我已经将VM配置为通过localhost访问主机上的Apache服务器,但:9000给出“未找到”。有人知道怎么做吗? 最佳答案 知道了!在我项目的Grunt.js文件中有这样的设置:grunt.initConfig({...connect:{options:{port:9000,//Changethisto'0.0.0.0'toaccesstheserverfromoutside.host

javascript - NodeJS/mySQL - ER_ACCESS_DENIED_ERROR 用户 'root' @'localhost' 的访问被拒绝(使用密码 : YES)

我正在尝试通过NodeJS文件连接到mySQL,但收到以下错误:{Error:ER_ACCESS_DENIED_ERROR:Accessdeniedforuser'root'@'localhost'(usingpassword:YES)atHandshake.Sequence._packetToError(/home/matthew/Node/mySqlTest/node_modules/mysql/lib/protocol/sequences/Sequence.js:30:14)atHandshake.ErrorPacket(/home/matthew/Node/mySqlTest/

javascript - NodeJS/mySQL - ER_ACCESS_DENIED_ERROR 用户 'root' @'localhost' 的访问被拒绝(使用密码 : YES)

我正在尝试通过NodeJS文件连接到mySQL,但收到以下错误:{Error:ER_ACCESS_DENIED_ERROR:Accessdeniedforuser'root'@'localhost'(usingpassword:YES)atHandshake.Sequence._packetToError(/home/matthew/Node/mySqlTest/node_modules/mysql/lib/protocol/sequences/Sequence.js:30:14)atHandshake.ErrorPacket(/home/matthew/Node/mySqlTest/

node.js - 获取 http ://localhost:3000/socket. io/socket.io.js 404(未找到)

我正在尝试将数据流式传输到浏览器。但是,我正在努力将其连接到浏览器。这是我的html:varsocket=io.connect();jQuery(function($){vartweetList=$('ul.tweets');socket.on('tweet',function(data){tweetList.prepend(''+data.user+':'+data.text+'');});});这是我的app.js的相关部分:varexpress=require('express'),twitter=require('ntwitter'),http=require('http'),