connect

Node.js connect only works on localhost

≡放荡痞女 提交于 2019-11-26 13:01:19
I've written a small node.js app, using Connect, that serves up a web page, then sends it regular updates. It also accepts and logs user observations to a disk file. It works fine as long as I am on localhost, but I can't get other commputers on the same intranet to see it. I am using port 3000, but changing to port 8080 or 80 didn't help. Here is the code I am using to set up the connection: var io = require('socket.io'), connect = require('connect'); var app = connect().use(connect.static('public')).listen(3000); var chat_room = io.listen(app); As stated above, I've tried changing the port

How to disable Express BodyParser for file uploads (Node.js)

北城以北 提交于 2019-11-26 12:53:27
问题 This seems like it should be a fairly simple question, but I\'m having a really hard time figuring out how to approach it. I\'m using Node.js + Express to build a web application, and I find the connect BodyParser that express exposes to be very useful in most cases. However, I would like to have more granular access to multipart form-data POSTS as they come - I need to pipe the input stream to another server, and want to avoid downloading the whole file first. Because I\'m using the Express

Java URLConnection Timeout

China☆狼群 提交于 2019-11-26 12:10:04
问题 I am trying to parse an XML file from an HTTP URL. I want to configure a timeout of 15 seconds if the XML fetch takes longer than that, I want to report a timeout. For some reason, the setConnectTimeout and setReadTimeout do not work. Here\'s the code: URL url = new URL(\"http://www.myurl.com/sample.xml\"); URLConnection urlConn = url.openConnection(); urlConn.setConnectTimeout(15000); urlConn.setReadTimeout(15000); urlConn.setAllowUserInteraction(false); urlConn.setDoOutput(true);

What is a good session store for a single-host Node.js production app?

浪尽此生 提交于 2019-11-26 10:06:26
问题 I\'m using Node\'s Express w/ Connect middleware. Connect\'s memory session store isn\'t fit for production: Warning: connection.session() MemoryStore is not designed for a production environment, as it will leak memory, and obviously only work within a single process. For larger deployments, mongo or redis makes sense. But what is a good solution for a single-host app in production? 回答1: Spent the day looking into this. Here are the options I've discovered. Requests/second are performed via

How to use passport with express and socket.io?

北城余情 提交于 2019-11-26 07:55:50
问题 I am currently trying to set up a basic authentication system for my node.js app. For now I am using express (3.0.0rc5), passport (0.1.12) and socket.io (0.9.10) with Mongoose as Store for session data. I have also been playing around with everyauth but I didn\'t like to work with promises. Current situation: Authentication through passport (facebook strategy) is successful, a session.sid cookie is set on the client after the redirect and I am able to see a session document in my database. I

nodejs connect cannot find static

三世轮回 提交于 2019-11-26 03:48:52
问题 NOTE: I have tried other solution given here but it didn\'t work A newbie with NodeJs. I am trying to follow AngularJS pro and got stuck with setting up NodeJs server. According to book, I installed nodejs and then installed connect package using npm install connect then downloaded angularjs in folder next to nodejs folder. Then wrote server.js file to connect to server. Here is the content of the file: var connect = require(\'connect\'); connect.createServer(connect.static(\"../angularjs\"))

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

ⅰ亾dé卋堺 提交于 2019-11-26 01:27:36
问题 I am getting the following error when I try to connect to mysql: Can\'t connect to local MySQL server through socket \'/var/lib/mysql/mysql.sock\' (2) Is there a solution for this error? What might be the reason behind it? 回答1: Are you connecting to "localhost" or "127.0.0.1" ? I noticed that when you connect to "localhost" the socket connector is used, but when you connect to "127.0.0.1" the TCP/IP connector is used. You could try using "127.0.0.1" if the socket connector is not enabled