Tagged Questions
0
votes
1answer
8 views
Not getting expected results from MongoDB in Express
I'm running NodeJS /w ExpressJS and MongoDB. I'm trying to create a very simple API but something is not working correctly. When I run api.js and go to /api/media/movies it gives me this output and ...
0
votes
0answers
20 views
Node/Socket IO Multiple Players
I am using node & socketi IO to create a simple multiplayer game. When a new client joins, I create a new HTML element with an ID which is each clients socket.id.
The clients are mobile devices, ...
0
votes
1answer
28 views
Node.js is unable to handle multiple tcp messages; Bug or feature?
Here is a simple TCP-Server stress test. As long as we send only one message per client everything works as expected. But when two messages per client are send,
the server suddenly stops without an ...
2
votes
1answer
17 views
My data from node did not bind to template variables
When i have tryied to deploy my simple nodejs blog app on Heroku I have very strage error. My data from node did not bind to template variables.
So I have right work app local
But after deploy on ...
0
votes
1answer
18 views
express - route middle ware how to determine if a response view is already rendered
I have created a custom route middle ware for express js.
Example:
var customRouter = function(req, res, next) {
console.log(res);
next();
};
and in app.js
app.use(app.router); ...
0
votes
1answer
33 views
How to write a complex object in memory to a file in nodejs
I am creating a complex object dynamically with nodejs in an effort to write this data to a file for use as a frontend utility library.
Is there any way that I can read/write this object to a file?
...
0
votes
1answer
11 views
Node.JS - Simple Socket.IO example not working. Getting debug - served static content /socket.io.js (Mac OSX/Localhost)
I just began with node.js a few days ago and I'm know trying to use socket.io module. But it is not working as I was expecting. The example I am trying to reproduce is this one :
...
0
votes
1answer
56 views
Javascript: adding dynamic method
I got the following problem.
I have different object like:
user with the method : id, username, firstname, lastname
article :with some other method;
i want to add dynamic method like getById, ...
1
vote
0answers
21 views
Socket.io - Double connection
I have a node.js server and client. It is a basic server, it just sends messages back and forth with no added extras. I have a more complex server which does a whole lot more and the issue is present ...
-1
votes
1answer
18 views
how to iterate through multiple collections in node js mongodb one by one
I want to iterate through multiple collections in nodejs mongodb one by one ie. take one collection process something on it than close that connection and than create new connection with other ...
0
votes
2answers
32 views
use a variable outside a function javascript
i am trying to get html from a web page though xmlhttprequest using node.js. The code that i have found on internet is:
var sys = require ('sys'),
url = require('url'),
XMLHttpRequest = ...
0
votes
1answer
33 views
Having problems structuring Cheerio scraping
I think this may be just basic syntax. I'm coming from Java and very new to Javascript. For example, when I see a $ in all the examples, my mind goes blank.
Code for parsing the HTTP request (which ...
-1
votes
0answers
16 views
How does Stapes.js work with Node.js?
For starting with a MVC & Node.js & MongoDB, this question is meant to help beginners over the wall of getting the main parts to talk in a most basic of apps.
How would this stapes.js code ...
0
votes
1answer
44 views
How to make Angularjs route work with expressJs route on html5mode
i have posted a question on stackoverflow (css and javascript didn't include on refresh) yesterday asking the question about why the css and javascript didn't include on my webpage after I refresh ...
0
votes
2answers
20 views
socket.io - socket.on wait for promise
I have a button that does some communication with the server to check if an entered value (via an input box) already exists. The code is the following:
$("#button").click(function () {
var exists ...
-1
votes
0answers
21 views
How would HTML5 window.localStorage route through Node.js into MongoDB?
Having read through the following tutorials:
www.nodebeginner.org/ .. full codeset here: http://jsfiddle.net/Ph3fh/
...
0
votes
2answers
29 views
What is the most common way to use a middleware in node with express and connect
Thinking about the correct way, how to make use of middlewares in a node.js web project using express and connect which is growing up at the moment.
Of course there are middlewares right now wich has ...
0
votes
1answer
21 views
req.session undefined in Express.js
I've seen several posts related to this but none solved my problem.
I have this code in server.js
var express = require('express');
var app = express();
app.configure(function(){
...
0
votes
1answer
39 views
How to output an RFC-822 compatible date string with JavaScript?
I'm using Node.js to build my RSS file. I create a Date string with (new Date).toString() and then use that value for the <pubDate> field in the RSS file. However, when I run the Feed Validator, ...
0
votes
0answers
18 views
Display SVG images using node.js?
Complete neewbie to node.js.
Do i need to install a plugin/module/mime type to get node.js to display SVG images in browsers?
I've tried using the <embed> and <object> tags a 'A plugin ...
1
vote
0answers
20 views
serving downloadable file on node.js
I have looked everywhere but cant find a solution for this.
I'm building a file hosting server using node.js. I want to use authenticated sessions/tokens to allow users access to downloadable files.
...
1
vote
3answers
36 views
module.exports scope and node-mysql
I have database.js file that connects to db and manage connections I export connection and reuse it in my app
var mysql = require('mysql');
pool = mysql.createPool({
host: ...
0
votes
0answers
11 views
Problems with using ncp inside my grunt plugin
for some reasons, I´m doing a custom grunt plugin for copy some specific directories. The idea for the plugin is to pass a parameter from console with the source path.
I´m using ncp module to copy ...
0
votes
0answers
24 views
Node.js ajax post to mongodb
I'm having problem with sending data from ajax client to nodejs and storing that data in a collection in mongodb.
Here's my client code:
testdata = {'test1':'test1', 'test2':'test2'}
...
0
votes
0answers
26 views
How do HTML + Stapes.js + Node.js + Mongoose + MongoDB talk to one another?
In evolving one's experience with more advanced Javascript, and having read through the following tutorials:
www.nodebeginner.org/ .. codeset here: http://jsfiddle.net/Ph3fh/
...
0
votes
0answers
12 views
Verifiy iOS Receipt with Node.js
After struggling a few days trying to get something to work and getting no where, I was wondering if someone has gotten iOS Receipt Validation working on Node.js. I have tried the node module ...
0
votes
1answer
35 views
MongoDB's Node.js Driver installation fails
I have nodejs and mongoDB installed on 32bit winXP veteran. And I am trying to link them.
In the mongoDB docs its stated that the easiest way is by this command:
npm install mongodb
Unfortunately ...
0
votes
0answers
16 views
Node.js write after end error zlib
I have the following code where I'm piping the request of a URL that's gzipped. This works just fine, however if I try to execute the code a few times, I get the below error. Any suggestions how to ...
0
votes
2answers
33 views
Dynamic method creation with javscript/nodejs
I'm trying to create a nodejs module that will have an api like this
**program.js**
var module = require('module');
var products = module('car', 'pc'); // convert string arguments to methods
// now ...
1
vote
2answers
44 views
Is statically typed nodeJS possible? i.e. TypeScript
I am looking to adopt NodeJS as a server language for a project. However, I am concerned with Javascript as a programming language and am also concerned the lack of type checking of Javascript.
Is ...
0
votes
0answers
16 views
Resources for WebDriverJs?
I understand there are the following resources:
http://docs.seleniumhq.org/docs/03_webdriver.jsp
https://code.google.com/p/selenium/wiki/WebDriverJs
But I was wondering if there was a site that ...
1
vote
1answer
28 views
Chrome.socket listener in browser
So I've searched very thoroughly and tried a lot of things to create a TCP or UDP listener for the Chrome.socket API in the browser in JavaScript. I am very confused now. So far I have tried using:
...
1
vote
0answers
42 views
ExpressJS set/get/use cookies
Cannot get setted cookies within requests.
I set my cookie with
response.cookie('name', 'My name');
I would like to get my cookie this way, and it worked before, but I changed express ...
1
vote
2answers
44 views
How to check filename string not to be a filepath
I am writing a server application on node js. Operating system is Linux.
I receive filename as a plain string, so it can be hacked. Then I concatenate the filename string and path string like this:
...
0
votes
3answers
47 views
Where is the global variable in Node.js hidhing?
a = 555
console.log(global.a)
outputs "undefined"
I have been told that global variables in Node go to the object global, but I cannot find it.
What I want to do is to write a function that will ...
3
votes
2answers
52 views
How can I parse records on demand with Node.js?
Is there a Node module that can parse a specific number of records from a CSV file? The use case is to parse a large log file and deliver records to a paging client as requested.
node-csv can't yet ...
0
votes
1answer
19 views
search listings by GPS coordinates
I'm working on an app, where people can create a listing that is tagged with GPS coordinates.
I'm using the Bing Map API to parse GPS into city and vice-versa.
Given GPS coordinates, I would like to ...
0
votes
1answer
27 views
which errors must be handled in nodejs?
Irrespective of any business logic, what errors must be handled in node server. ?
What are potential errors/exceptions ?
I have tried to take care of following things-
uncaughtException
socket ...
2
votes
3answers
213 views
How to get rid of Connect 3.0 deprecation alert?
I'm a node.js developer who creates web apps using express.js.
By now, my problem is:
Whenever I create an app on my computer, npm install its stuff and run it (with node app.js and nodemon) I get ...
0
votes
1answer
18 views
AngularJS $resource 'GET' accesses the correct API, but 'PUT' and 'POST' do not
Follow up from AngularJS $resource calls the wrong API URL when using method:POST
My controller is set up like this, with Angular's $resource:
$scope.updateProduct = ...
0
votes
0answers
27 views
Which would be the ideal way to make a node.js server work along with a php server? [on hold]
According to this post, a way to connect Node and PHP would be using socket.io.
I don't know if i got it wrong, but it seems that it's in fact operating with TWO servers, a node.js in the background, ...
1
vote
1answer
38 views
Strongnode vs Nodejs - What are strongnode's advantages?
The toolset that strongnode adds is a clear advantage over plain nodejs, for example with its command line tool you can scaffold, monitor and provide a mobile backend for your nodejs apps.
But in ...
0
votes
1answer
32 views
Optional parameters for MongoDB query
Let's say I have two events:
{"id":1, "name":"event1"},
{"id":2, "name":"event2"}
And I am writing a REST API to retrieve events. This API takes an optional parameter, id, which if present, returns ...
0
votes
1answer
21 views
Changing MongoDB location in Node.js
By default MongoDB save location (where the actual database will be) is /data/db (on Windows at least). But I'd like to change the location for a certain Node.js application, to say ...
1
vote
3answers
36 views
Trying to iterate through an array and add a get function for each
I want to iterate through the style tags and write a GET function for each. The problem is the GET function is being written with a reference to 'styleTags[i]' instead of converting 'styleTags[i]' to ...
0
votes
1answer
23 views
Using $http.post and res.redirect without resolving the promise
I am using an $http.post call to my server and sending over some user data:
$http.post('/streamdb/create/',{user:$scope.user.username})
My server then performs a series of operations and retrieves ...
1
vote
2answers
39 views
Testing URLs with Node.js
Assuming I have an array of URLs and I want to ensure each URL is working I have created the following code. However only the last URL in the array is getting tested. How can I ensure each url ...
0
votes
3answers
98 views
Joining two collections efficiently?
I have run into an issue where I am trying to join two arrays similar to the ones below:
var participants = [
{id: 1, name: "abe"},
{id:2, name:"joe"}
...
0
votes
2answers
27 views
MongoDB query on populated fields
I have models called "Activities" that I am querying for (using Mongoose). Their schema looks like this:
var activitySchema = new mongoose.Schema({
actor: {
type: ...
0
votes
1answer
29 views
Is it safe to use and update global variables in NodeJS?
I have a node server for loading certain scripts that can be written by anyone. I understand that when I fire up my Node server, modules load for the first time in the global scope. When one requests ...