1
vote
0answers
12 views

Node / Mongoose - Schema's JSON is undefined when sent to the HTML page

Basically, I have a Mongoose Schema which is a Tournament, so in that Tournament we have an array of Teams...the Teams are stored as references to the Team Schema. This is an example Team: { name: ...
0
votes
0answers
17 views

Best way to embed a real time widget using node.js

So, i'm developing with node.js and express a webapp where people create a "widget" that they can embed in their articles. I use socket.io to deliver the users the content. Using express I was ...
1
vote
0answers
16 views

Controlling Multiple Processes in Node

Okay, so I have a bot hosting thing I do. It's pretty much the only thing I have right now that's keeping me sane. It's an IRC type bot for a music/chat website, and it does a lot of things. But the ...
0
votes
0answers
12 views

writing buffer to a file - how can I keep binary format?

I have this code in coffescript: fs = require 'fs' class PpmCanvas constructor: (@width, @height, @fileName) -> size = @width * @height * 3 array = new Uint8ClampedArray size ...
-1
votes
1answer
18 views

websocket connection invalid - Socket.IO

I developed a web application that uses socket.io on my windows platform, and it worked perfectly. However, as soon as I move it over to my debian 6 production dedicated server, it starts dropping ...
0
votes
1answer
39 views

Unit of Work in JavaScript

I'm developing a blog system and at this point, I need to do three (or more) SQL update/inserts in a Atomic operation. If one of insert or update operations has failed, all other operations also ...
-2
votes
1answer
31 views

Node.js javascript modules on client side

I'm writing a game using node.js+express+socket.io. It took a long time to get where I am but i feel it finally got me. I have server which servs html and js files in this way: app.post('/game', ...
2
votes
1answer
35 views

node.js - how to make a simple live page update?

I'm very very new to node.js, but there's actually only one simple thing that I am trying to achieve by learning the language. I'd like to create a webpage, where by the code in a specific "div" can ...
0
votes
2answers
21 views

How can I render content in my Jade template using functions in express?

I've got a working user register/login page, the only thing left is making content based on whether the user is logged in or not. After reading I came up with this: app.use(function(req, res, next) { ...
1
vote
1answer
35 views

how to fetch value from JSON object?

I want to delete data from the table and database using multiple select. but it only deletes the first row selected. I also use the Firebug to fetch the req.body.id for the WHERE condition of my sql ...
0
votes
1answer
16 views

Alternatives to HTTP chunking for persistent connections?

According to the W3C specification on Server-Sent Events: Authors are also cautioned that HTTP chunking can have unexpected negative effects on the reliability of this protocol. Where possible, ...
0
votes
0answers
9 views

Forbidden by CSRF on my registration form, not sure why

I have setup CSRF on my Express v3 app, and I have it like this: app.use(express.session({ secret: "gdagadgagd", cookie: { httpOnly: true, path : '/', maxAge: 1000*60*60*24*30*12 } ...
1
vote
1answer
28 views

node.js: program either exits unexpectedly or just hangs

I wrote a module in node.js that performs some network operation. I wrote a small script that uses this module (the variable check below). It looks like this: check(obj, function (err, results) { ...
1
vote
1answer
31 views

What's the most efficient way to apply a function to all objects in a collection in MongoDB?

Suppose I want to calculate the "popularity" field for all objects in my collection. It depends on the difference from the current time to the field "submitTime" and the numbers in the field "votes". ...
0
votes
1answer
33 views

Best way to urldecode (php) in NodeJS

So I am trying to decode a string that was previously urlencoded with php in Node. About a month ago I had it working with: querystring.unescape(str.replace(/\+/g, '%20')); Then it just stopped ...
0
votes
2answers
50 views

Easiest way to import MySQL database in nodejs for integration testing

I have an web app built with nodejs and I want to do some integration testing of my API that will involve hitting a live database. Is there any easy way to load & execute an SQL dump file to ...
0
votes
1answer
57 views

How do I set up a javascript Class with inheritance + private properties + getters / setters

I wish to use https://github.com/mozilla/BrowserQuest/blob/master/server/js/lib/class.js with private inheritable properties and also some getters and setters in there. Basically I want the getter / ...
0
votes
0answers
22 views

pushState does not generate a PopStateEvent

In my attempt to reinvent some wheels and learn how a front-end router works, I want to abstract over using hashbangs or push/popstate for more modern browsers. Here is the (Node.JS) server, serving ...
0
votes
1answer
22 views

Error starting a test with testacular

I am trying out the angularjs tutorials on a 64 bit Windows 7 system because I find this framework quite interesting from what I read on its home page. I am a newbie to node.js and not experienced in ...
0
votes
1answer
15 views

Deploy node app and mysql

How to deploy node application into services supported mysql. I've try with c9, nodejitsu, but they aren't support database mysql. Please help me!
0
votes
1answer
22 views

Trying to push my Node.js app to Heroku, Error: ENOENT with jade npm

As the title says, I'm trying to push my app to Heroku, but I keep getting these errors: 291 error Error: ENOENT, chmod '/tmp/build_htb3av307zzc/node_modules/jade/bin/jade' 292 error If you need ...
1
vote
1answer
42 views

In MongoDB, how come searching for an email that does not exist, crashes my entire app

In my Node.js express app, I'm just setting up a user sign in, this is my first time going through this just kind of self teaching. I have this function here, var db = ...
0
votes
0answers
16 views

CherryPy Real-Time Web Application

I've inherited a web application that is running a CherryPy web server. I need to implement a user interface that will automatically update with data from the server. Right now the solution is to use ...
-3
votes
0answers
39 views

Multiplayer cards game [closed]

I want to create a multiplayer cards game, but I need your help choosing the tools. I don't have any problems with the server side, I'm willing to use Node.js and Socket.io. But for the client side, ...
1
vote
0answers
48 views

How do I properly aggregate mongodb results from two separate content types in my node.js app?

How do I properly aggregate results in a view using node.js & mongoose from mongodb. My programmer colleague came up with the following route to aggregate event and blog posts in one list/view of ...
2
votes
3answers
48 views

Can a variable be made readonly in Node.js

I want to prevent a variable from being changed. Specifically a property of an Object: var foo = { bar: 'baz' }; // do something to foo to make it readonly foo.bar = 'boing'; // should throw ...
0
votes
1answer
19 views

How can I use Y.mojito.models in middleware?

I'm using nodejs with the mojito mvc framework. Do I have access to some global variables from middleware? How can I use Y.mojito.models in middleware? // ./middleware/mymiddleware.js module.exports ...
0
votes
0answers
39 views

Unable to load java module by node js

I am trying to use the java bridge API in node.js. I have installed a java module locally and globally but nothing works for me. I am getting the following error: throw new Error("Cannot find module ...
0
votes
0answers
29 views

What is the most efficient fraction library in Javascript [closed]

I need to do some complicated non-transitive dice rolling probability and expected value calculations in JavaScript and I'm worried about accuracy and efficiency. Because of the accuracy concern, I ...
0
votes
0answers
22 views

Return type of request method in request Module Node.js

i have an existing code in Node.js.i have to understand it .i didn't have very good understanding of Javascript. in this node.js file we used request module but when we call request method as return ...
0
votes
1answer
26 views

how to check if a parameter is present in the querystring in node.js

How to validate if a parameter is exits in the querystring or not in the node.js ? I am validating like this if(prm1 == null) return error But actually in the console.log(prm1) says undefined.. ...
1
vote
2answers
91 views

JSON.stringify = illegal access

I have an array with objects in Javascript. I want to save this array to a .json file. Before I added the objects to the file, I console.log the objects. // Client Object {id: "1", color: "#00FF00"} ...
1
vote
1answer
44 views

Node.js pass variable to module vs pass variable to every module function

I'm learning node.js and interested in is there any difference between following two cases. I.E. I have some variable myvar (like db connection or just constant string "test") that needed to be passed ...
0
votes
1answer
30 views

Migrating from asp.mvc application to node.js application with a focus on design [closed]

I am currently looking into alternative platforms to migrate an existing application onto, it started out as a prototype using asp.mvc but the majority of code is javascript with a simple asp mvc web ...
0
votes
0answers
42 views

TypeError: object is not a function (Node js)

Sorry but I have a question about Node.JS. I have to do a project about OAuth2 and I want to make a POST request. exports.acceptedLog = function (req, res) { request({ method:'POST', ...
0
votes
1answer
30 views

Is it possible to handle both async and sync function results inside a sync function in node.js?

I'm working on a library that pre-processes less, stylus, etc. Preprocessors can be both async and sync in nature. Because the result will only be used in build stage, writing blocking code here is ...
1
vote
2answers
26 views

Update specific values in a nested array within mongo through mongoose

I have somewhat the following schema(without _id) - {uid: String, inbox:[{msgid:String, someval:String}] } Now, in the request I get the msgid and I use it in the following mongoose query like ...
0
votes
3answers
49 views

Recursive callbacks

Need a little help trying to get this breadcrumb builder working - it's a recursive fetch for parent categories that should return an array of entries. Not quite working and my brain is fried.... ...
0
votes
2answers
28 views

How do I validate input with MongoDB?

I have a simple little user registration form that looks like this: // POST Register new user exports.new = function(req, res) { var db = require('mongojs').connect('localhost/busapp', ...
4
votes
0answers
55 views

Why would an exception cause resource leaks in Node.js?

If you look at the beginning of the Node.js documentation for domains it states: By the very nature of how throw works in JavaScript, there is almost never any way to safely "pick up where you ...
0
votes
0answers
18 views

socket.io client connect URI changing?

I am excited to be creating my first, simple, socket.io interaction with an existing nodejs application. I succeeded in adding socket.io into my node server and serving the js file directly from that ...
-1
votes
0answers
22 views

Looking for a solid tutorial on how to use MongoDB with Node.js [closed]

I'm trying to use MongoDB with Node.js, and I've been googling for a simple tutorial for user registration/login but everything that I find, includes Express, I'm avoiding using Express for education ...
1
vote
1answer
37 views

Converting random bytes to an integer range - how?

I'm trying to get a random integer within a range by reading from crypto.randomBytes(). Now, my problem is that I do not know how to read integers from that byte stream. I imagine generating a range ...
0
votes
2answers
18 views

Catch express bodyParser error

I want to catch the error from the bodyParser() middleware when I send a json object and it is invalid because I want to send a custom response instead of a generic 400 error. This is what I have and ...
5
votes
1answer
42 views

Is there already pre-existing code for supporting Dojo AMD, NodeJS require and Browser window.[something] for a Javascript micro library

I have some code which supports writing a micro-library and having it loaded in Dojo AMD, NodeJS require() and the browsers normal window.[something]... But I was wondering if there are already ...
0
votes
1answer
27 views

How to correct this test case in mocha framework?

I am trying to write test case for node application, which is using mocha as test framework. test.js var register = require('../routes/users'); var request = require('request'); var baseUrl = ...
0
votes
2answers
31 views

How to check if an embedded document exist in database before saving in mongoose

Im making a basic authentication system using express, mongoose and passport. What I want to do is to check the database if the entered username and password already exist in the database, here's my ...
1
vote
1answer
29 views

Error in crypto deciphering

Why does the following code throw up a DecipherFinal error in crypto - var crypto = require('crypto'); c=new Date; x= (c.getTime()+"."+c.getMilliseconds()).toString()+".uIn"; key = ...
0
votes
0answers
17 views

how do i obtain the tweets from a user's timeline using ntwitter?

This the code to retrieve a track how do i modify this to get the tweets of a particular user? var twit = new twitter({ consumer_key: 'CONSUMER_KEY', consumer_secret: 'CONSUMER_SECRET', ...
0
votes
1answer
21 views

How might I make a template file in Jade so I can include it in other pages?

I've made a header file that I would like to include in all my pages, it also includes the navbar and has the body in it to in a nutshell it is like this !!! html head title body I would like ...

1 2 3 4 5 119
15 30 50 per page