589
votes
3answers
111k views

How do I get started with Node.js

Are there any good resources to get started with Node.JS? Any good tutorials, blogs or books? Of course, I have visited http://nodejs.org/, but I didn't think the documentation they have is a good ...
344
votes
10answers
59k views

What is node.js? [closed]

I don't fully get what node.js is all about. Maybe it's because I am mainly a web based business app developer. Can someone please explain what it is and the use of it? Thanks. My understanding so ...
48
votes
7answers
14k views

How to use redis PUBLISH/SUBSCRIBE with nodejs to notify clients when data values change?

I'm writing an event-driven publish/subscribe application with NodeJS and Redis. I need an example of how to notify web clients when the data values in Redis change.
92
votes
3answers
27k views

What is the purpose of NodeJS module.exports and how do you use it?

I cant seem to find any info on this but it appears to be a rather important part of NodeJS as I often see it in source code. According to the node docs : module A reference to the ...
6
votes
3answers
5k views

socket.io.js not found

For some reason my node server cannot serve the route /socket.io/socket.io.js, I always get a 404 error. I tried compiling different node versions (current is 0.6.13 which also runs on server, where ...
131
votes
24answers
38k views

Is there a template engine for Node.js?

I'm kind of falling in love with Node.js not because you write app code in javascript but because of its performance. I really don't care a lot about how beautiful a server side language might be ...
26
votes
8answers
13k views

node.js execute system command synchronously

I need in node.js function result = execSync('node -v'); that will synchronously execute the given command line and return all stdout'ed by that command text. ps. Sync is wrong. I know. Just ...
165
votes
8answers
46k views

How to debug node.js applications

How do I debug a node.js server application? Right now I'm mostly using alert debugging with print statements like this: sys.puts(sys.inspect(someVariable)); There must be a better way to debug. I ...
81
votes
12answers
20k views

node.js on multi-core machines

node.js looks interesting BUT... I must miss something - isn't node.js tuned only to run on a single process & thread? Then how does it scale for multi-core CPUs and multi-CPU servers? After all, ...
43
votes
4answers
27k views

HTTP POST request in node.js

How can I make an HTTP POST request with data in node.js?
34
votes
5answers
26k views

What MySQL drivers are available for node.js? [closed]

Is there a Node.JS Driver for MySQL that is commonly used other than node-mysql? (It seems like there is not much activity with node.js database drivers. Is there a reason for this or is it just ...
15
votes
4answers
5k views

Pattern for CoffeeScript modules

While reviewing the source code for CoffeeScript on Github, I noticed that most, if not all, of the modules are defined as follows: (function() { ... }).call(this); This pattern looks like it ...
53
votes
4answers
31k views

Good beginners tutorial to socket.io? [closed]

I am very new to the world of webdevelopment and jumped into the bandwagon because I find the concept of HTML5 very interesting. I am fairly confident on working with canvas and would now like to move ...
47
votes
3answers
28k views

NodeJS: Write to file

I've been trying to find a way to write to file when using NodeJS but with no success. Can you help me with this. Thanks.
30
votes
5answers
7k views

Coordinating parallel execution in node.js

The event-driven programming model of node.js makes it somewhat tricky to coordinate the program flow. Simple sequential execution gets turned into nested callbacks, which is easy enough (though a ...
28
votes
4answers
13k views

Rails 3.1 error - Could not find a JavaScript runtime?

I created a new Rails project using rails 3.1.0.rc4 on my local machine but when I try to start the server I get: Could not find a JavaScript runtime. See here for a list of available runtimes. ...
14
votes
2answers
7k views

Node.js & Express.js: Breaking up the app.js file

Is there a common convention for breaking up and modularizing the app.js file in an Express.js application? Or is it common to keep everything in a single file?
41
votes
4answers
4k views

Why and When to use node js? [closed]

Possible Duplicate: How to decide when to use NodeJS? Sorry if i'm a bit ambiguous, but i'm trying to understand the real advantages of using node.js instead of other server-side language. ...
26
votes
5answers
14k views

Get and Set a Single Cookie with Node.js HTTP Server

I want to be able to set a single cookie, and read that single cookie with each request made to the nodejs server instance. Can it be done in a few lines of code, without the need to pull in a third ...
33
votes
4answers
18k views

Javascript, NodeJS: is Array.forEach asynchronous?

I have a question regarding the native Array.forEach implementation of Javascript: Does it behave asynchronously? For example, if I call: [many many elements].forEach(function () {lots of work to ...
15
votes
6answers
13k views

Global variables for node.js standard modules?

I know that global variables are bad. But if I am using node's module "util" in 40 files in my framework, isn't it better to just declare it as a global variable like: util = require('util'); in ...
7
votes
1answer
3k views

Node.js, multi-threading and Socket.io

I'm looking to get Socket.io to work multi-threaded with native load balancing ("cluster") in Node.js v.0.6.0 and later. From what I understand, Socket.io uses Redis to store its internal data. My ...
26
votes
4answers
11k views

Scrape web pages in real time with Node.js

What's a good was to scrape website content using Node.js. I'd like to build something very, very fast that can execute searches in the style of kayak.com, where one query is dispatched to several ...
31
votes
4answers
20k views

How to use underscore.js as a template engine?

I'm trying to learn about new usages of javascript as a serverside language and as a functional language. Few days ago I heard about node.js and express framework. Then I saw about underscore.js as a ...
37
votes
10answers
6k views

How can I share code between Node.js and the browser?

I am creating a small application with a JavaScript client (run in the browser) and a Node.js server, communicating using WebSocket. I would like to share code between the client and the server. I ...
24
votes
5answers
10k views

Understanding promises in node.js

From what I have understood there are three ways of calling asynchronous code: Events: eg. request.on("event"), callback); Callbacks: eg. fs.open(path, flags, mode, callback); Promises I found a ...
18
votes
2answers
11k views

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!
12
votes
3answers
3k views

garbage collection with node.js

I was curious about how the node.js pattern of nested functions works with the garbage collector of v8. here's a simple example readfile("blah", function(str) { var val = getvaluefromstr(str); ...
7
votes
4answers
7k views

Node.js with Express: Importing client-side javascript using script tags in Jade views?

I've got a node.js express server running with the Jade template engine. I've got a layout jade file which imports the body of individual views like so: !!! html head title= title || ...
12
votes
5answers
5k views

Express framework giving a very strange error

I'm trying to use Express in node, install everything okay, compiled, got npm and installed express with: npm install express The problem is, everytime I try to "require" it, it gives me an ...
250
votes
3answers
24k views

How to decide when to use NodeJS?

I am a n00b in this kind of stuff but lately I've been hearing a lot about how good NodeJS is. Considering how much I love working with jQuery and Javascript in general, I can't help but wonder how to ...
58
votes
7answers
11k views

Can I use CoffeeScript instead of JS for node.js?

What are my restrictions if I want to code node.js and use CoffeeScript? Can I do anything I'd be able to do in JS? Thanks
27
votes
9answers
5k views

How to avoid long nesting of asynchronous functions in Node.js

I want to make a page that displays some data from a DB, so I have created some functions that get that data from my DB. I'm just a newbie in Node.js, so as far as I understand, if I want to use all ...
9
votes
5answers
3k views

websocket api to replace rest api?

I have an app whose primary function works in real time, through websockets or long polling. However most of the site is written in a RESTful fashion, which is nice for apps and other clients in the ...
30
votes
7answers
8k views

Read a file one line at a time in node.js?

I am trying to read a large file one line at a time. I found a question on Quora that dealt with the subject but I'm missing some connections to make the whole thing fit together. (link to the Quora ...
10
votes
2answers
2k views

How can I edit on my server files without restarting nodejs when i want to see the changes?

I'm trying to setup my own nodejs server, but I'm having a problem. I can't figure out how to see my edited files without restarting nodejs. Is there a way to edit file live with nodejs?
13
votes
4answers
1k views

Writing a chat application

I'm wondering what's the right way to code a chat application for thousands of users. I'm just confused how will I be able to ping the server using AJAX every second or maybe less and check if there ...
24
votes
9answers
17k views

JavaScript require() on client side

Is it possible to use require() (or something similiar) on client side? Example var myClass = require('./js/myclass.js'); Thanks for reply.
10
votes
2answers
2k views

pack / unpack functions for node.js

Are there any modules that provide pack / unpack functionality for nodejs similar to python's struct module? I haven't found any specifically for node, and I'd assume that javascript implementations ...
22
votes
3answers
5k views

How to copy a file?

How to copy a file in Node.js? Example + /old |- image.png + /new I want to copy image1.png from 'old' to 'new' directory. This doesn't work. newFile = fs.createWriteStream('./new/image2.png'); ...
11
votes
6answers
6k views

Synchronize asynchronous calls in node.js

I've been trying to wrap my head around this issue for the last hours but can't figure it out. I guess I still have to get used to the functional programming style ;) I wrote a recursive function ...
8
votes
3answers
2k views

Node.js: What techniques are there for writing clean, simple callback code?

node.js code is known for turning into callback spaghetti. What are the best techniques for overcoming this problem and writing clean, uncomplex, easy to understand callback code in node.js?
17
votes
6answers
10k views

Get local IP address in node.js

I have a simple node.js program running on my machine and I want to get local IP address of PC on which is my program running. How do I get it with node.js?
9
votes
2answers
3k views

How do I move file a to a different partition in Node.js?

I'm trying to move a file from one partition to another in a Node.js script. When I used fs.renameSync I received Error: EXDEV, Cross-device link. I'd copy it over and delete the original, but I don't ...
5
votes
4answers
741 views

online Node.js server

Is Node.js mature enough to make entire web applications in it? I mean entirely in Node.js. I read somewhere that for some reason there should be (for example) nginx behind Node.js. Is it true? Can't ...
0
votes
3answers
2k views

Javascript: REGEX to change all relative Urls to Absolute

I'm currently creating a Node.js webscraper/proxy, but I'm having trouble parsing relative Urls found in the scripting part of the source, I figured REGEX would do the trick. Although it is unknown ...
17
votes
3answers
4k views

How to write a test which expects an Error to be thrown

I'm trying to write a test for the Jasmine Test Framework which expects an error. At the moment I'm using a jasmine nodejs integration from github. In my nodejs module I have the following code: ...
8
votes
3answers
2k views

Getting closure-compiler and Node.js to play nice

Are there any projects that used node.js and closure-compiler (CC for short) together? The official CC recommendation is to compile all code for an application together, but when I compile some ...
5
votes
2answers
957 views

Secure distribution of NodeJS applications

What: Can NodeJS apps be distributed as binary? ie. you compile the .js app via V8 into its native binary, and distribute the binary to clients? (if you had total access to the NodeJS server)... or is ...
5
votes
4answers
4k views

JADE + EXPRESS: Iterating over object in inline JS code (client-side)?

i want to implement a google map based on its api. i want to add a path based on coordinates to it. therefore i get my coordinates from my model and want to iterate over the object to fille the map ...

1 2 3 4 5 9
15 30 50 per page