node.js

a server side mustache.js example using node.js

I'm looking for an example using mustache.js with node.js here is my example but it is not working. Mustache is undefined. I'm using Mustache.js from the master branch. var sys = require('sys'); var m = require("./mustache"); var view = { title: "Joe", calc: function() { return 2 + 4; } }; var template = "{{title}} spends ...

NodeJS: Write to file

I've been trying to find a way to write to file when using NodeJS, but no success. Can you help me with this. Thanks. ...

Data store for capturing votes & aggregating them

I'm interested in using Node.js as a socket server for stream-based communication with tens of thousands of clients. Clients will be sending votes for particular pieces of content, and receiving near-realtime updates of aggregated vote tallies from the server. The datastore needs to support: Storing the votes Summarising the votes in ...

Where is the node.js file in the stack trace located?

Obviously, I'm pretty new to node.js. I'm attempting to debug a node.js application and I see node.js in the stack trace. I would like to put some sys.puts calls in there, but I cannot locate the node.js that is being run by my server. Is there a way to tell where node.js is located? Is there an equivalent to Ruby's __FILE__ in node? ...

Stream data with Node.js

I want to know if it is possible to stream data from the server to the client with Node.js. From what I can understand all over the internet is that this has to be possible, yet I fail to find a correct example or solution. What I want is a single http post to node.js with AJAX. Than leave the connection open and continuously stream dat...

Need help with setting up comet code

Does anyone know off a way or maybe think its possible to connect Node.js with Nginx http push module to maintain a persistent connection between client and browser. I am new to comet so just don't understand the publishing etc maybe someone can help me with this. What i have set up so far is the following. I downloaded the jQuery.come...

Can tcp and http connection listeners can interact with each other or not?

Is there a way in which the http connection and tcp connection listeners can interact with each other? I have two separate application modules one is working through http and other requires tcp . I need to do an interaction between these two modules so is there way i can make my http based module interact with tcp based module. ...

Long polling getting timed out from browser

I'm trying to serve long polling requests for 60 secs using node.js. The problem I'm facing is, the browser is getting timed out. The same setup is working for 30 secs. Can anybody suggest how to achieve this? Using JQuery as JS framework. Thanks... ...

NodeJS and HTTP Client - Are cookies supported?

Hi folks, NodeJS is a fantastic tool and blazing fast. I'm wondering if HTTPClient supports cookies and if can be used in order to simulate very basic browser behaviour! Help would be very much appreciated! =) EDIT: Found this: node-httpclient (seems useful!) not working! ...

POST request and Node.js without Nerve

Is there any way to accept POST type requests without using Nerve lib in Node.js? ...

Node.js appears to be missing the multipart module

I am trying to parse form data, including upload files with a node.js http server. All of the tutorial type articles I have found use a require("multipart"); to include the multipart module, but when I try the same I get: Error: Cannot find module 'multipart' I also can't find it in the current api docs (though it is in the google cac...

How is a functional programming-based javascript app laid out?

I've been working with node.js for awhile on a chat app (I know, very original, but I figured it'd be a good learning project). Underscore.js provides a lot of functional programming concepts which look interesting, so I'd like to understand how a functional program in javascript would be setup. From my understanding of functional pro...

Is there a sprintf equivalent for node.js

Looking to do output formatting (sprintf type functionality) in node.js, but before I write it myself I was wondering if there's something similar built-in (I've trawled the docs to no avail) or if someone's already written a module. Many thanks ...

node.js real-time game

Is it possible to create a real time game with node.js that requires twitch reflexes. How high is the latency? How low can it realistically go? ...

getting all filenames in a directory with node.js

I can't find where in the documentation I can get all filenames in a directory Thanks for any help! ...

When to use TCP and HTTP in node.js?

Stupid question, but just making sure here: When should I use TCP over HTTP? Are there any examples where one is better than the other? ...

Why Won't the WebSocket.onmessage Event Fire?

Hey guys, After toying around with this for hours, I simply cannot find a solution. I'm working on a WebSocket server using "node.js" for a canvas based online game I'm developing. My game can connect to the server just fine, it accepts the handshake and can even send messages to the server. However, when the server responds to the clie...

What does addListener do in node.js?

I am trying to understand the purpose of addListener in node.js. Can someone explain please? Thanks! A simple example would be: var tcp = require('tcp'); var server = tcp.createServer(function (socket) { socket.setEncoding("utf8"); socket.addListener("connect", function () { socket.write("hello\r\n"); }); socket.addListener(...

node.js database

I'm looking for a database to pair with a node.js app. I'm assuming a json/nosql db would be preferable to a relational db [I can do without any json/sql impedence mismatch]. Considering couchdb mongodb redis Anyone have any views / war stories re compatiability/deployability of the above with node.js ? Any clear favourites ? ...

Real time ruby apps: CRAMP vs NODE.JS

Hi folks, i was wondering if any of you had insights about which one is better, and what factors should be taken into consideration when using one of these ...