Tagged Questions
1
vote
1answer
16 views
req.files not working node.js - express
Hey so I am trying to accept an uploaded file but everytime I call req.files it is considered undefined... Not sure what I am doing wrong...
This is my app.js file:
var express = require('express')
...
0
votes
1answer
8 views
Should I be nesting async.mapSeries in Node.js?
I need to loop through cells in a matrix.
Each cell has a request associated with it, and I must wait for each request to finish before moving onto the next.
I currently use async.mapSeries to loop ...
0
votes
0answers
21 views
npm unable to fetch Meteorite
With nodejs v0.10.22 and npm v1.3.14, I tried installing meteorite as shown below:
$ npm install meteorite
npm http GET https://registry.npmjs.org/meteorite
npm http 304 ...
0
votes
1answer
15 views
SpookyJS: Console.log Doesn't Work Inside Then
try {
var Spooky = require("spooky");
} catch (e) {
console.log(e);
}
var spooky = new Spooky({
capser: {
logLevel: "debug",
verbose: true
},
child: {
command: ...
0
votes
1answer
21 views
Synchronous less compiling in NodeJS
I'm trying to write a transform script for Browserify that allows me to require() .less files. The transformation will compile them to CSS and then wrap that minified CSS in a little Javascript ...
0
votes
0answers
14 views
Is it a good idea to port modules to streams2?
There are some widely used userland modules like through and duplex that are now useless (are they ?) because there are implementations of those on the core stream module.
Because of this I've been ...
0
votes
1answer
22 views
How to recieve some files at A node.js/express server and send files to B node.js/express server
I'm working on node.js express servers
I'm stuck! Cant find correct answer in documentation or somewhere else
I need able to:
recieve 2-3 PDF files at server A from client-side -->
upload those ...
3
votes
2answers
64 views
why is this private method in a constructor?
I'm a bit puzzled by this coding pattern I've run into even though I've been studying up on 'this.' The following (simplified) code shows the pattern:
var MyConstructor = function MyConstructor() {
...
1
vote
2answers
28 views
WebSocket connection to OpenShift app failed
I created an app with NodeJS and I'm using ws module. If I test the app in localhost it works and there isn't any problem to connect websockets. Now I've upload the app to Openshift and when I try to ...
0
votes
1answer
24 views
call a function from another file in node.js
Inside the below job.js node script how can i call /getJobs .Am using following way but getting $ is not defined.
job.js
var jobScedule = function (time, jobid) {
var params = {
"id": ...
1
vote
2answers
35 views
http request in node.js
Iam using following code to send request to a host machine
is there any possible way to send a json data along with options.
var options = {
host: '172.16.2.51',
port: ...
0
votes
0answers
19 views
Advice to resolve window dependency when running in node.js
I'm trying to extend my browser-side library's runtime environment to node.js. I implemented the Universal Module Definition (UMD) pattern to do that. It works with AMD implementation and ...
0
votes
0answers
7 views
Node JS & pdfkit - addPage() loop
I'm using Node.js and pdfkit to generate name tag labels. The goal is to send an array of people objects with First & Last names and the Quantity qty of labels for each person. Here's what I've ...
1
vote
1answer
13 views
Nodejs Express: Unrecognized content-type
I'm attempting to send a file from a phonegap application to a nodejs server and am having problems with the content-type of the request headers.
Error: unrecognized content-type: ...
2
votes
1answer
18 views
Phonegap File Upload: Empty request body & files
Trying to upload an amr file from a mobile device to a server with Phonegap, using the FileTransfer plugin.
var uri = "./" + $scope.audio.src;
$scope.audio.release();
var options = new ...
0
votes
0answers
15 views
How to write a vows js bdd test for an asynchronous recursive operation
Code.js
var Util = function(){
function factorial(n, callback){
if(n == 1){
return n;
} else {
return n*factorial(n-1, callback);
}
}
...
1
vote
0answers
24 views
Socket.io session variable
I am fairly new to node.js and express and I am trying to build a fairly simple application through phone gap which allows me to have a user login, and save that users socket id to a session, so I can ...
3
votes
2answers
23 views
Node.js tutorial web server not responding
I was viewing this post while trying to get started Node.js, and I started working with this guide to learn the basics.
The code for my server is :
var http = require('http');
...
0
votes
1answer
27 views
How to create image file on server using dataURL?
In my app I have used canvas on which the user can draw images. On save button I get the dataURL from the canvas. Now I want to save the image created by user on the server(node.js).
I have read Node ...
0
votes
0answers
18 views
403 serving resources from localhost
I've just installed Nodejs and Grunt, mainly for using Grunt's livereload when mocking up different UI ideas. No worries starting the server and viewing index.html, but get 403 errors for all css and ...
0
votes
0answers
8 views
Run local task after Grunt-Hub watch triggers
I'm using Grunt-Hub to watch and compile several sub-projects. When a sub-project is triggered and its tasks run, I need to then run specific local tasks in the root project's Gruntfile.js. This is ...
0
votes
0answers
26 views
Node javascript session undefined request or property
I'm having a weird problem with nodejs and sessions.
I have traced the problem down to session.save function,
TypeError: Cannot read property 'sessionStore' of undefined
at Session.save (C:\Program ...
0
votes
2answers
38 views
Trailing zeros in javascript
Is there a way to add trailing zeros to a number in javascript?
For example:
47.0 instead of 47
or 0.0 instead of 0
when I return the numbers in a json, the zeros disapper.
I need them to be ...
0
votes
1answer
35 views
Node/Express - How to wait until For Loop is over to respond with JSON
I have a function in my express app that makes multiple queries within a For Loop and I need to design a callback that responds with JSON when the loop is finished. But, I'm not sure how to do this ...
1
vote
3answers
38 views
Error traversing large arrays in JavaScript without timeout
When I'm am executing the following code in Node.js, I get the folliowing error:
RangeError: Maximum call stack size exceeded
This is the code:
var arr = [];
for (var i = 0; i <= 1000000; i++)
...
1
vote
1answer
28 views
How to maintain a request session in NodeJS
I'm trying to use NodeJS to scrape a website that requires a login by POST.
Then once I'm logged in I can access a separate webpage by GET.
The first problem right now is logging in. I've tried to ...
0
votes
0answers
11 views
Node JS Views as static directory
I'm building a CMS in Node JS inspired in Wordpress.
I want to make a directory that contains the all the views of jade and the assets of the theme.
It is possible? I need help to implement it.
...
1
vote
1answer
36 views
Storing up-to-date array index in a separate array with JavaScript
I have an array of objects. Key of the array is generated automatically with .push(). Some objects might be removed from the array with delete array[index];. Array might contain anything from 0 to ...
0
votes
0answers
28 views
Correct usage of process.exit in NodeJS
I'd like to start off by saying that I'm a complete NodeJS noobie.
So, that being said, I'm trying to get a better understanding of the behavior of parent and child processes when using the Cluster ...
2
votes
1answer
47 views
Encrypt string in PHP and decrypt in Node.js
I am sending data through insecure connection between Apache and Node.js servers. I need to encrypt data in PHP and decrypt in Node.js. I've spent 2 days trying to get it to work, however I only ...
0
votes
0answers
16 views
How to read data events (chunks) from node.js request object
I'm having trouble with something very basic. Going through node.js in Action (great book so far!) and I can't get this simple example to work. Perhaps it's because the stream api was updated after ...
0
votes
0answers
26 views
Getting model's camelCase attributes, when underscored property is true
My model has underscored property set to true.
Sequelize loads such attributes well, but leaves camelCased attributes undefined. Is it a bug or intended behaviour? How to make it work?
Example:
...
1
vote
1answer
25 views
Passport.js LocalStrategy logic
I want to understand how does LocalStrategy work.
Here is a part of my server file:
var passport = require('passport');
var express = require('express');
/* other initializations */
var app = ...
0
votes
1answer
48 views
how to call external javascript file in html using node.js
I am a complete node.js newbie and struggling with the basics.I have a html file and I would like to call external javascript file in the html page using node.js in local host environment.
JS:
var ...
-2
votes
0answers
17 views
Error creating session : parse error node js
i am getting error after start server when i load page see this only
{
"message": "Unknown error",
"code": 500
}
Error creating session : parse error
thanks
0
votes
0answers
19 views
r.js not working throws module path does not exist error
Am almost through building my app and now i want to optimize my js files. Am using require.js and i have recently read about r.js. My app folder structure looks like this
/js
/libs
/apps
...
0
votes
0answers
37 views
Strange behavier with node js sessions
I count how many wrong password was entered and when It is 5 attempts I write his email into session.
Then I send email and start timer after 30 second I make callback and unlock user. I print data ...
0
votes
0answers
17 views
NodeJS - Kue: How to prevent that a job is defined complete until an interval of time or an specific event
i was working with Kue (https://github.com/learnboost/kue) and i was facing this problem: I've made 2 jobs that are different but pretty dipendent: one for executing a command and another one for ...
0
votes
0answers
23 views
Inluding nodejs js file to ejs file
Hello i am starting to work with nodeJS and also using Express and ejs. The thing that I would like to do is create a menubar which is in a seperate ejs file and link this to a nodejs js file. The ...
0
votes
1answer
20 views
On an EventEmitter, how can I know all the events I can listen to?
Supposing I have an object that inherited from EventEmitter, like a stream or any other, is there a good way to know all the events I can listen to, and all the attached event listeners ?
I think the ...
-2
votes
0answers
27 views
Better Solution of nodejs callback asynk waterfall method
Have any better Solution of nodejs callback asynk waterfall method
I Use the below code For Creating a JSON Object … My Code Is Below...
var mysql = require('mysql');
...
0
votes
0answers
19 views
Get google+ user profile in node using just access token
I am trying to get the user profile details in Node.
The flow is such that I have a mobile app that generates the token for me (by authenticating through Google plus native SDK), then I send the ...
-2
votes
0answers
15 views
How can we call external node file from sailjs controller?
I want call "cli.js add -k test" from sailjs controller,
and want output in some variable of sailjs controller file
3
votes
2answers
81 views
Global scope for every request in NodeJS Express
I have a basic express server that needs to store some global variables during each request handling.
More in depth, request handling involves many operation that need to be stored in a variable such ...
1
vote
1answer
47 views
Restart SetInterval in Javascript
I'm having a hard time restarting the time to 10 seconds after i clear the interval.
when the status is success it should re run again the set Interval
Below is my code :
<code>
var countdown ...
0
votes
2answers
31 views
Nodejs best way to implement database connection (mysql)
I'm working on a nodejs server.
I see there are many ways to implement mysql connection as:
1 connection and never it never end (handle error and re connect again)
A connection pool (How can i know ...
0
votes
4answers
65 views
Send json response to Jquery
Am using following code to get some response from client machine and getting that response properly .But i have to send that response to Jquery.I dont know how it is possible?"
var getOsLists = ...
0
votes
0answers
46 views
Using generators to wait for input before continuing the body of a forEach loop
I just can't figure this out no matter how many generators articles I read...
I've also tried installing all the fibers libraries, and none of them will install on my machine, but that's okay, because ...
0
votes
1answer
21 views
spawn a child process in node.js
In node.js am trying to spawn a child process
i have to pass an argument(mode=All) also while executing an exe file
Am doing in the following way.But does not get anything
`var exec = ...
-1
votes
2answers
27 views
Javascript: efficiency of window object for calling user defined functions
In my nodejs application, I am communicating or say calling functions present in two different js file using window.myfunction = function(){...} way. Indeed its working perfectly. I went through this ...