Latest Node.js Recipes

Backbone Node - fetch - server sending only response object but not model ,how can i get model?

Backbone,Node : when i call fetch method, fetch is successful in server but when it sends response back using


it is not sending(may be) any model or it is sending old model back,and it is sending only response object . Model is...

Read the entire recipe Recipe added 18 minutes ago

nodejs cannot connect to server?

I've been staring at node.js and examples all afternoon and i'm trying to piece together a simple page that will tell me how many users I have connected to the server.

I have read the documentation at as well as a few...

Read the entire recipe Recipe added 1 hour, 18 minutes ago

Deploy Geddy to Heroku

I'm trying to deploy a simple Geddyjs (node.js) app to Heroku.

When I make a push a recive that error:

git push heroku master

Heroku receiving push
Heroku push rejected, no Cedar-supported app detected

What I have to do to that heroku detect the...

Read the entire recipe Recipe added 2 hours, 24 minutes ago

Change to STDOUT logging on nodejs app

Following on from this: ENOENT error using nodejs on heroku

I've been suggested to use STDOUT logging on my node.js app...? Is this possible? If so, how / where do I configure this?

Read the entire recipe Recipe added 3 hours, 21 minutes ago

Node.js and Google Pagespeed API

I'm trying to build a little Google Pagespeed client in Node, but I'm struggling with the https client. The request always returns with a 302 response, but the exact same url works perfectly in curl and browsers

options = {

Read the entire recipe Recipe added 4 hours, 23 minutes ago

references in node.js callbacks

I have just been writing some tests when a fundamental problem emerged. I wrote the bare skeleton of a test framework. It first collects all tests (their callbacks) in an array and executes them afterwards in a separate loop. However, this...

Read the entire recipe Recipe added 5 hours, 22 minutes ago

Uploading and storing images

Yes, I know about Uploading images using Node.js, Express, and Mongoose and How can I store images in mongodb with node.js? but the solution to those isn't what I want to achieve. I want to be able to use a Schema for the image to be stored in binary...

Read the entire recipe Recipe added 6 hours, 23 minutes ago

Reference error: "Tags is not defined"

I have manipulated the code in this application, and put in a sidebar in the views/layout.jade file. In the sidebar I've cut/pasted the code for handling tags from views/index.jade:

        each tag in tags
            a(href='/tag/' +...

Read the entire recipe Recipe added 7 hours, 16 minutes ago

'session' is undefined when using express / redis for session store

I'm trying to use redis for sessions in my express app.

I do the following:

var express = require('express');
var RedisStore = require('connect-redis')(express);

app.configure('development', function(){     
    app.use(express.session({ secret:...

Read the entire recipe Recipe added 8 hours, 18 minutes ago

Calling variables outside couchdb function?

I'm having alot of trouble getting couchdb's response handlers to do anything useful with node.js and now.js. My aim is to call back to a client or group with certain information that's been found and also sent from a client. =...

Read the entire recipe Recipe added 9 hours, 20 minutes ago not found

For some reason my node server cannot serve the route /, I always get a 404 error.
I tried compiling different node versions (current is 0.6.13 which also runs on server, where it actually works).
From the app.js I get info:...

Read the entire recipe Recipe added 10 hours, 18 minutes ago

Heroku Logs - open log referred to in error message

I'm deploying a node.js app to heroku (cedar stack)

I've set the NODE_ENV like this:

heroku config:add NODE_ENV=production

I then do:

git push heroku

However, after starting (i've got a console.log generating the first log entry) the...

Read the entire recipe Recipe added 11 hours, 16 minutes ago

Connect2 and

I'm trying to get connect and to work together nicely and simply. I have the following code on server side:

var connect = require('connect'),
    io = require('');

var app = connect().use(connect.logger('dev'));
var sio =...

Read the entire recipe Recipe added 12 hours, 16 minutes ago

Client side + Server side templating, feels wrong to me, how to optimize?

In the web app I am making, I use the classical Express+Jade to render client pages and also expose some REST API (let's say : "user list API").

These client pages use provided API to retrieve "user list" and display it. To display it, I use the...

Read the entire recipe Recipe added 13 hours, 23 minutes ago

Dynamic view compilation and rendering express.js

Is there a way to compile and render a .jade view on the fly eg. if it was stored in a db or would it have to be written to the file system first or is it possible to hook into the view system to achieve this.

Read the entire recipe Recipe added 14 hours, 23 minutes ago

Deploying a Windows Azure app from the Command Line?

I checked out smarx's noderole/packanddeploy and want to test it locally, then deploy it to Azure, but without using Visual Studio. How could I do that?

Read the entire recipe Recipe added 15 hours, 20 minutes ago

Express 3.0 req.flash?

-- EDIT --

I wrote some middlware to do this:

So since the release of Express 3.0, the changes have removed req.flash() (source)

So here is...

Read the entire recipe Recipe added 16 hours, 20 minutes ago

node.js REPL "undefined"

Upgraded from node 0.4.11 to 0.6.15, and noticed the REPL (running node with no arguments) keeps dumping "undefined" after most commands or carriages returns...

It's distracting and driving me batty, how do you disable this?


Read the entire recipe Recipe added 17 hours, 21 minutes ago

jsdom doesn't process script inside web page

I am new to nodejs. I want to use jsdom to parse some web pages which may contain script code inside. But I got error said the function or variable was not defined. Can anyone give some directions about this.

my code

var jsdom =...

Read the entire recipe Recipe added 18 hours, 24 minutes ago

Nodejs , wait until current request completes, then proceed (or) wait until firstfunction executes before going to second function

I use nodejs code:

var ret = firstfunction();  //this calls database and gets some return value
var output = secondfunction(ret); // in this function we used ret as parameter 

Before firstfunction() completes , and before it gets the value "ret",...

Read the entire recipe Recipe added 19 hours, 17 minutes ago

Node command line interface change

I'm making a command interface for a node server, but I have reached a point that I want it to look better.

I want to have the console so you enter a command at the bottom of the terminal screen, you hit enter, and it adds the reply to the actual...

Read the entire recipe Recipe added 20 hours, 22 minutes ago

Key generation requirements for TLS ECDHE-ECDSA-AES128-GCM-SHA256

I was wondering if there are minimum key-generation requirements for ECDHE-ECDSA-AES128-GCM-SHA256 and ECDHE-ECDSA-AES128-GCM-SHA256? I am trying to get a TLS client and server using one of the above algorithms to connect to each other and keep...

Read the entire recipe Recipe added 21 hours, 24 minutes ago

Nodejs execute exported function from string

I want to know if it's possible to run a function that is named a string in nodejs. All this code is running on the server side with no browser appearance at all.

Assuming I export a file test.js with the following code

module.exports.test =...

Read the entire recipe Recipe added 22 hours, 19 minutes ago

which is best for performance while referring using _id? While retrieving using _id, i am getting error INVALID OBJECT ID

How should i refer a collection in another collection , a unique username or default _id (object id) or a normal id that increments when a new record is inserted . I read that object ids increase performance in mongoose , but i am unable to retrieve...

Read the entire recipe Recipe added 23 hours, 21 minutes ago

error with nTwitter while using nodejs

I am trying nTwitter (nodejs v0.6.10) - I tried using the example code for searching twitter but I get the following error when trying the search function for the library (the keys I am using appear to be correct):

Cannot set property 'q' of...

Read the entire recipe Recipe added 1 day ago