Skip to main content
Filter by
Sorted by
Tagged with
9 votes
2 answers
4k views

Where are the CommonJS modules?

From time to time I hear that CommonJS http://www.commonjs.org/ is an effort to create a set of modular javascript components but frankly I have never understood anything of it. Where are the these ...
ajsie's user avatar
  • 79.8k
1 vote
2 answers
161 views

Setting variable without callback

How is it possible that script continues even without proper setting variable? Thanks for reply! Code function get(param) { // Connect to database and get the response ~ 1 sec db.get(param, ...
Ryan Zygg's user avatar
  • 341
1 vote
1 answer
5k views

Node.js and undefined properties

I'm trying to use GET variables to transfer some simple data but for some reason I'm doing it wrong. My code is pretty simple. I use Node.js HTTP & URL libraries. When I try to run following code,...
Mike's user avatar
  • 113
11 votes
5 answers
4k views

Do i need Node.js in Python like I would with PHP?

I have been using PHP for some time now. And I have been thinking about learning Node.js to go along with it to use the non blocking idea for creating an online game or app. There is quite a bit of ...
skift's user avatar
  • 1,027
1 vote
1 answer
3k views

node.js and nginx SSL handshake failure

I'm trying to create a basic SSL connection from a node.js app to a locally hosted nginx server; it involves sending the client's credentials as well. The handshake seems like it was successful as ...
Gus's user avatar
  • 13
8 votes
6 answers
26k views

Getting client hostname in Node.js

is it possible to get hostname in Node.js? This is how I get client's IP: var ip = request.header('x-forwarded-for'); So, how do I get client's hostname? var hostname = request.header('???'); ...
Ryan Zygg's user avatar
  • 341
2 votes
2 answers
527 views

Long polling server principle (client identification)

I want to create a simple long polling server in node.js where communication will be based on jsonp requests. I understand that client makes request and server holds response until some data are ready ...
yojimbo87's user avatar
  • 68.4k
1 vote
4 answers
717 views

Should I re-write my game server, write a forwarder, or use a new plugin?

I have a game server written in python and twisted, and an old game client also in python. I have written a new game client in Javascript, which will connect with websockets. Now I face a design ...
Nathan's user avatar
  • 6,225
0 votes
2 answers
280 views

User interacting interpreter in a non-blocking single-threaded environment (tricky)

For a school project me and a classmate are writing a domain-specific language in javascript (node). The language contains statements that require user input via a Websocket connection. When a ...
Michael Andersen's user avatar
10 votes
4 answers
3k views

MongoDb vs CouchDb: write speeds for geographically remote clients

I would like all of my users to be able to read and write to the datastore very quickly. It seems like MongoDb has blazing reads, but the writes seem like they could be very very slow if the one ...
SeekingNonblockingIo's user avatar
3 votes
3 answers
447 views

What are the differences between Opera Unite and Node.js?

Both seem to allow coding applications entirely in JavaScript. Both allow server side JS as well as client-side JS. So, from a technology and programming standpoint, what is the difference between ...
shwetank's user avatar
  • 436
0 votes
2 answers
544 views

Node.js core dumps on Windows 7

I am on windows 7 and installed Node.js using this tutorial: http://howtonode.org/how-to-install-nodejs When I am trying to run the tests , everything "CRASHES" (I don`t know why) and when I am ...
Yosi's user avatar
  • 2,976
0 votes
2 answers
167 views

Is it possible to load the CSS stylesheets applied to a DOM in node.js?

This is a snippet of what I'm trying to do at the moment: var sys = require("sys"), request = require("request"), $ = require("jquery"), uri = 'http://' + process.argv[2]; ...
Steve's user avatar
  • 5,853
0 votes
1 answer
789 views

How can you use selectors that match multiple nodes via jsdom/jquery in node.js?

I have a very simple example thus far, I'm basically trying to rip the path to a logo from a website dynamically. var sys = require("sys"), request = require("request"), $ = require("jquery"), ...
Steve's user avatar
  • 5,853
164 votes
23 answers
64k 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 ...
Kay Pale's user avatar
  • 6,569
2 votes
1 answer
1k views

Node.js and SSL with Restler

I have installed latest version of Node.js and I still have problems with SSL and Restler. Where's the problem? Thank you! Request var restler = require('./lib/restler'); restler.get('https://...
Ryan Zygg's user avatar
  • 341
2 votes
1 answer
3k views

Install node.js on PowerVPS

I have one VPS from PowerVPS which has CentOS 5.5 (default configuration). I need to install Node.JS for an Ajax IM installation. Does anyone have any advice/information on how to install Node.JS on ...
Prakash's user avatar
  • 2,723
185 votes
24 answers
121k views

How to check whether a script is running under Node.js?

I have a script I am requiring from a Node.js script, which I want to keep JavaScript engine independent. For example, I want to do exports.x = y; only if it’s running under Node.js. How can I ...
theosp's user avatar
  • 7,549
6 votes
5 answers
5k views

V8 engine compiles JavaScript to machine code. So, why node.js isn't faster than C?

According to language benchmarks, JavaScript V8 is faster than other programming languages at regex-dna program. So, why node.js applications (i.e. http server) isn't faster than C applications (i.e. ...
Jeff's user avatar
  • 15.4k
6 votes
1 answer
6k views

node.js concurrency

I'm new in node.js. I'm testing socket.io for real time messaging. I love it and I want to use. I have a question. How many concurrency can run in Node.js server ? Our program will be approximately ...
saturngod's user avatar
  • 24.9k
81 votes
7 answers
70k views

Make node.js not exit on error

I am working on a websocket oriented node.js server using Socket.IO. I noticed a bug where certain browsers aren't following the correct connect procedure to the server, and the code isn't written to ...
RobKohr's user avatar
  • 6,953
8 votes
4 answers
5k views

javascript - event driven and concurrency issues?

Greetings, I've been studying javascript, nodejs. And I don't understand how the concurrency issues are avoided in javascript. Lets say I'm working on a object var bigObject = new BigObject(); ...
Daniel's user avatar
  • 7,172
3 votes
1 answer
2k views

Using AMQP and Node.JS for realtime data syncing

I'm building a web-based productivity application that has to deal with modest user concurrency, and I've been exploring various options to keep the data in sync between the server and client. The ...
Gary Chambers's user avatar
0 votes
1 answer
922 views

Read from file every time or load into array Node.js

I need to know if my idea is a good one. Im putting together a web server that streams html file js file css file, kind of static web server. As it been static i was thinking that i only need to ...
Tim P.'s user avatar
  • 421
1 vote
1 answer
1k views

direct (non-tcp) connection to redis from nodejs

hello all I looked at the at the redis-node-client source (relevant part is shown bellow) and I see that it connects to redis via the 'net' package, which is TCP based. line 370 exports....
deepblue's user avatar
  • 8,596
10 votes
1 answer
20k views

Parse XML Libxmljs (Node.js)

I'm attempting to parse an XML string with libxmljs (https://github.com/polotek/libxmljs). I'm having some issues though. I need to apply logic to what I'm parsing and return based upon what's defined ...
A Wizard Did It's user avatar
4 votes
1 answer
2k views

Porting node.js server-side code to HTML5 WebSockets

Note: This is not about using both node.js and HTML5 sockets. I'm also not interested in discussing the merits of the setup I'm describing. node.js runs on the server, and, since it supports ...
Kev's user avatar
  • 16.3k
5 votes
3 answers
7k views

PostgreSQL sockets from JavaScript (HTML5)

I'm looking at options to connect directly--without a web server or middleware--to a PostgreSQL server using JavaScript from a web browser client. On github, I found three projects: node_postgres ...
Kev's user avatar
  • 16.3k
5 votes
3 answers
3k views

How to pause in the middle of a function (delay return) and continue on event

Is there a way to stop in the middle of a function, and wait for a certain event before continuing?
Michael Andersen's user avatar
1 vote
3 answers
3k views

node.js: Why does NODE_DEBUG=1 not work? (trying to debug a require() error)

I have a directory structure like so: project lib paperboy redis-client node-cookie srv main.js ... I start main.js from the project directory: $ node srv/main.js In main.js, ...
Jon Watte's user avatar
  • 7,228
5 votes
3 answers
8k views

Node.js copy remote file to server

Right now I'm using this script in PHP. I pass it the image and size (large/medium/small) and if it's on my server it returns the link, otherwise it copies it from a remote server then returns the ...
A Wizard Did It's user avatar
1 vote
2 answers
2k views

javascript regex single-line

I'm trying to replace all @import strings in one single-string, e.g. var str = 'buttons .reprint{height:56px;background-position:-47px -1496px;}@import "../common/buttons.css";@import "../screen/...
Alex Ivasyuv's user avatar
  • 8,844
3 votes
3 answers
3k views

.NET ServerVariables("AUTH_USER") and a non ASP page

I'm going to be running a node.js server in a Windows environment (via Cygwin) on an internal network that needs access to the Windows login information of the client. The best method I've come up ...
A Wizard Did It's user avatar
1 vote
0 answers
1k views

nodejs and node-webworker

so this neat library is helping me with some things, but its acting strange with others. I can see in its github repo history: https://github.com/pgriess/node-webworker/commit/...
deepblue's user avatar
  • 8,596
12 votes
5 answers
3k views

Client Side Dependency Management in CoffeeScript

What is the best way to do Dependency Management amongst CoffeeScript files if the resulting javascript files eventually need to be concatenated together for use on the client side? For server side ...
Douglas Sellers's user avatar
614 votes
12 answers
335k views

How can I write a test which expects an 'Error' to be thrown in Jasmine?

I'm trying to write a test for the Jasmine Test Framework which expects an error. At the moment I'm using a Jasmine Node.js integration from GitHub. In my Node.js module I have the following code: ...
echox's user avatar
  • 9,850
58 votes
6 answers
70k 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 ...
ajsie's user avatar
  • 79.8k
0 votes
1 answer
802 views

Modifying 'global' object in Node.js

Is there any reason why the following code: global.myNamespace = {}; fails to add 'myNamespace' to the global object, i.e. typeof global.myNamespace returns 'undefined' Node.Js 0.3.1-pre
Art's user avatar
  • 24.6k
9 votes
4 answers
19k views

'Global' object in node.js

I am using 0.3.1-pre Node.js Doing this: typeof global.parseInt results in 'undefined' However when pressing [Tab] in the console after typing 'global.' gives a list of functions, including ...
Art's user avatar
  • 24.6k
1 vote
2 answers
845 views

Chaining methods in Javascript

I want to chain methods in Javascript (using Node.js). However, I encountered this error: var User = { 'deletes': function() { console.log('deletes'); return this; }, '...
ajsie's user avatar
  • 79.8k
15 votes
2 answers
13k views

Is anyone using node.js with an OAuth2.0 authentication system? [closed]

Is there an OAuth2.0 library for Node.js, which is being used (or planned to be used) in a live, production system?
blueberryfields's user avatar
49 votes
10 answers
21k views

Does node.js support yield?

Is there any way to get generators into node.js? I'm currently faking them with callbacks, but I have to remember to check the response of the callback inside of my generator function which creates a ...
Paul Tarjan's user avatar
  • 50.7k
5 votes
1 answer
2k views

node.js + connect 404 error

I just started learning node.js. I have following (server) sample: var app = require("express").createServer(); app.listen(80); function fail(req, res, next) { setTimeout(next, 10); } function ...
Gabe's user avatar
  • 51
5 votes
2 answers
5k views

Create chained methods in node.js?

Is it possible to create chained methods that are asynchronous like this in node.js File.create('file.jpg').rename('renamed.jpg').append('Hello World') That is to say non-blocking.
ajsie's user avatar
  • 79.8k
4 votes
2 answers
3k views

RESTful MongoDB with Nodejs example needed

I'm trying to use MongoDB with REST interface on NodeJS express and I'm puzzled. I've read about REST all day and I just cannot grasp it. Let's say I have an untrusted (browser) client. The untrusted ...
Andrei Sch.'s user avatar
2 votes
2 answers
651 views

Can somebody help me understand node.js and how & why I might use it with a framework like rails?

I'm trying to write a scalable interactive chat application for an existing high traffic website. It needs to be scalable on day 1, and chat's concurrency and multi-broadcast issues make it a tricky ...
cjm2671's user avatar
  • 19.5k
33 votes
3 answers
5k views

JavaScript BDD: Vows & Kyuri Vs. Jasmine [closed]

I was going to go with Vows and Kyuri, but then I found out about Jasmine. Which do you recommend? Vows or Jasmine? Is there a Cucumber implementation that works with Jasmine?
ma11hew28's user avatar
  • 127k
292 votes
11 answers
273k views

Sending emails in Node.js? [closed]

I recently started programming my first node.js. However, I discovered that I am unable to create a contact me form that sends straight to my email since I can't find any modules from node that is ...
NycCompSci's user avatar
  • 3,137
0 votes
2 answers
1k views

Injecting methods/variables into a Javascript scope

I want to be able to use methods that I haven't required() at the beginning of the file. Something like this: var contact = require('contact'); person = contact.create({ 'name': createName() });...
ajsie's user avatar
  • 79.8k
3 votes
2 answers
183 views

Method chaining in javascript

This working code is using Sproutcore: person = SC.Object.create({ firstName: 'Foo', lastName: 'Bar', fullName: function() { return this.get('firstName') + " " + this.get('...
ajsie's user avatar
  • 79.8k