Tagged Questions
0
votes
1answer
6 views
Can I delete a file from inside a mocha unit test?
Trying a few node.js filesystem checks (to confirm if environment is functioning correctly)
When I write my fs.unlink or fs.unlinkSync outside of Mocha it deletes the file as expected:
var fs = ...
0
votes
0answers
11 views
Can't access a response from inside a callback function
I have a problem finishing a response from within a callback function. The following pared-down code is supposed to check inside a mysql connection query if a table exists and finish the response with ...
0
votes
0answers
11 views
Expressjs: Rendering views depending on application state
I'm creating express app and my app accomodates two states- logged in user and anonymous user. My app doesn't require user to login in order to view the content of the site. Currently, the state is ...
0
votes
0answers
4 views
Travis CI times out on node jasmine tests, but passes locally
I've been working on a command line app in node that does some file system reads and express app stuff, and all my tests are passing locally, however Travis seems to be having an issue when building ...
0
votes
0answers
14 views
Express.js Malicious Path Middleware Error 403
I get this error when I make a post request to my server, but only on my production server (pre-release) - my staging server works fine. Both are AWS ubuntu boxes.
Looking through the stack trace, ...
0
votes
1answer
12 views
Stylus Not Defined After Successful npm install
I'm attempting to follow along with a tutorial and learn a bit about node.js. I keep getting a weird error, though. After npm install stylus, I get this:
npm http GET ...
0
votes
1answer
23 views
Node.js VM and string concatenation
I have an HTML file thats dynamically generated and only has a javascript object commented out. I'm trying to read that file, take the object out as a string, and run it with VM's runInNewContext(). ...
2
votes
1answer
26 views
Global object / scope and undefined circular references
I'm not sure I understand the results of these few experiences :
Experience n°1 (in new command line) :
> _
ReferenceError: _ is not defined
at repl:1:2
at REPLServer.self.eval ...
0
votes
1answer
12 views
Node --debug-brk app.js not functioning
I'm trying to debug my app but something is stopping the app from actually firing up when I use --debug-brk flag.
Here's my output normally:
/usr/local/bin/node app.js
Express server listening on ...
0
votes
0answers
21 views
Node/Javascript: Redirect After Verification Button
I'm using a framework called PartialJS that follows a MVC architecture to build a webApp that will verify a user's input and make a request to an API and render the API response.
I'm not sure how to ...
0
votes
3answers
39 views
In node.js and express, how should a client send a large, up to 3k, amount of data to the server?
the client will be sending my server a change log, containing a list of commands and parameters, JSON or not is TBD.
This payload can be a 3 or 4K not likely to be more.
What is the standard ...
0
votes
0answers
15 views
Unable to download msnodesql-0.2.1-v0.6-x64.msi
I am getting this error. The problem might be a change I made in install.js file:
install.js
var msiName = "msnodesql-0.2.1-v0.6-x64.msi";
var msiUrl = {
path: 'C:\\Users\\Qazi ...
1
vote
3answers
64 views
how i can wait to function
i write in node.js an html page and i want to wain in the response to the data but it to faster..
how i can create this function sync?
app.get('/showGuides', function(req, res) {
text = ...
0
votes
0answers
9 views
Using Breeze.js EntityManager from within Node
I'm interested in being able to use the Breeze.js EntityManager and query capabilities within a node console service to access a remote Data Service that exposes an BreezeJS/OData compliant RESTful ...
0
votes
0answers
20 views
Node.js domain cluster worker disconnect
Looking at the example given at the nodejs domain doc page: http://nodejs.org/api/domain.html, the recommended way to restart a worker using cluster is to call first disconnect in the worker part, and ...
1
vote
1answer
29 views
Can't get POST body from request using Express.js
I'm working on an API with NodeJS and Express (and more stuff like mongo, sockets, etc) but i'm stuck on a very simple step i believe, i'm just trying to get the information from the POST req object, ...
0
votes
2answers
21 views
How to handle Redis session when db disconnects
I am having issues with losing my Redis connection that I use for sessions in my Express App:
var RedisStore = require('connect-redis')(express);
sessionStore = new ...
0
votes
1answer
23 views
Define mongoose and Schema only ones
Hi i am developing nodejs application with express and mongodb.So i must define mongoose and schema in my all routing js to use mongo and schema. I want to define them only ones. I am new at node.js ...
1
vote
0answers
27 views
Node.js/Javascript library to test if point is in geojson multipolygon
Is there some library for node.js or javascript in general that provides a function to check if a coordinate is in a geojson multipolygon?
I'm trying to create a small HTTP API that tells me which ...
0
votes
1answer
19 views
grunt globbing except a file
I have a list of files:
'app/scripts/module.js',
'app/templates/templates.js',
'app/scripts/**/*.js'
This will load app/scripts/module.js, app/templates/templates.js and then all the files under ...
0
votes
2answers
23 views
exclude a folder from expressjs routing
On my expressjs app, public assets are loaded in this way:
app.use(express.static(__dirname + '/public'));
And then I redirect all requests to the index, to handle every path with Backbone
...
0
votes
1answer
12 views
How to process geonames city data in Node.JS
So I understand that this isn't the traditional way to share code but seeing how there isn't anything on the stack about how to accomplish such a task - I figured I'd share.
To further explain, I ...
0
votes
1answer
39 views
socket.emit() not working
I write a simple code.
Server:
var io = require('socket.io').listen(55550);
io.set('log level', 1);
io.sockets.on('connection', function (socket) {
socket.emit('news', { hello: 'world' });
...
0
votes
1answer
32 views
How do you access values passed to next() functions in Node
I'm using Node with Express.js to write a back-end for a project I'm working on.
next() functions are used in middleware to move to the next piece in the middleware chain, and finally onto the ...
1
vote
0answers
19 views
Make a knockout js application extensible(plug-able), which interacts with PHP [on hold]
I wrote a form builder with knockoutjs which interacts data with PHP in back-end. It has only regular fields such as password field, text area, email, drop down and so on...
Now, I have to make it ...
0
votes
1answer
13 views
Dynamically construct an ACS object
I'm using Titanium Appcelerator, and Node.ACS to manage my server pages. I must use some APIs to update objects, which basically are JSON objects.
I want to do a function to update one field of an ...
0
votes
1answer
16 views
Error: Cannot find module, but only on Heroku
My application runs just fine locally, and on a Travis CI build server but when its on Heroku
I get Error: Cannot find module and the app crashes.
Some facts about the npm module
it lives on ...
1
vote
2answers
27 views
How can I wrap a precompiled hogan.js template into an AMD module?
I'm trying to incorporate precompiling my Mustache templates into my build process. I'm using AMD for code organization so I'd like to wrap my compiled functions into modules.
I'm trying to do the ...
0
votes
0answers
15 views
What does npm WARN excluding symbolic link mean?
What does npm WARN excluding symbolic link mean? And how do I make it go away?
0
votes
1answer
31 views
Nodejs and express are not able to locate resource file(CSS & JS file)
I'm try to use express to build a simple website.
everything it's works fine, until I decide to add a below code to catch 404 error
app.get('/*', function(req, res) {
res.render('404.ejs',{
...
1
vote
1answer
30 views
TypeError: Cannot call method 'toLowerCase' of undefined
I ran into an error and I don't know why. I try to transform all the character into lowercase before inserting into database and for comparison purposes.
At the first function this.addUser I call ...
1
vote
1answer
30 views
Is there any real danger to overriding the default 'console' in node?
I'm a habit driven creature, and console.log/console.error/etc happens to be the thing I just instinctively use to print things out. However, I'm trying to drive all my logging in node to 'winston'. ...
0
votes
0answers
22 views
Socket.io sending message to specific users but not all users in the chat
I am trying to figure out how I can send messages to only a specific group of users. I know how to send it to all the users. I tried using Room but I am not sure why is it not displaying on the ...
1
vote
1answer
19 views
Access cookies from Sails.js controller
How do I access browser cookies from sails.js controller?
This:
cookie = req.param('cookie', 'No cookie specified');
cookies = req.param('cookies', 'No cookie specified');
returns the default ...
2
votes
1answer
56 views
Wait until forEach loop is finished?
Adding a callback straight after the forEach loop doesn't work. I'm new to node.js so any help would be appreciated, thanks.
This is for a Minecraft bot that logs players login and logout times. ...
0
votes
1answer
45 views
JavaScript return value from function
Folks, following bit of code does not return 'baz' properly. It says its undefined. Why?
getJSON = function(options, onResult)
{
//console.log("rest::getJSON");
var prot = options.port == ...
0
votes
0answers
13 views
ZombieJS opening a new page document after submitting a form using AJAX
I'm using ZombieJS for testing my application.
I'm trying submit a form which is being submitted using ajax. But instead of acting like what a normal browser would do, it opens a new window ...
0
votes
0answers
38 views
Nodejs build and linking error for native c library when building IP2Location addon with node-gyp
I'm trying to use IP2Location addon for Nodejs. Normal installation using npm install ip2location to no avail. Throw error like this
sh-3.2# npm install ip2location -g --verbose
npm info it worked if ...
0
votes
0answers
37 views
Express POST - Returned JSON is treated as invalid by JQuery
I am trying to write a small authentication service using Express and Node.
I did a search on SO and don't seem to find my answer
even though there're many similar questions but no
definitive answer ...
0
votes
1answer
24 views
Node.js + Coffeescript Class Inheritance with multiple exports?
In Node.js and Coffeescript, I have defined a class, Connector, which inherits from Node's EventEmitter.
I want to define a subclass of Connector, called Foo. When I try to define a new instance ...
0
votes
2answers
40 views
Convert UTF8 to int16 in javascript
I read a binary file (of 16bit integers) in my node.js code and send it to client using connection.sendUTF(data) of websocket. At the javascript code of the client side I receive an array of UTF8 and ...
0
votes
1answer
50 views
Has node.js problems with Albert Einstein?
(the server adds a new user in a table using node.js and Express and MySQL)
Client:
...
console.log(options.path);
var request = http.request(options, function(res) {
res.on('data', ...
2
votes
1answer
29 views
Why does creating and deleting an Azure Table fail?
I am wondering why trying to run the following test suite fails when I try to delete the table I have stored entities in. The error I get is the following
1) Azure Storage cloud storage operations ...
1
vote
1answer
22 views
Jade template engine could not add <p> tag to the inside of div
Could not add "p" tag to the inside of div. Here is my code:
!!!
html
head
title= title
link(rel='stylesheet', href='/stylesheets/#{stylesheet}.css')
link(rel='stylesheet', ...
0
votes
0answers
34 views
Proper way to convert javascript Date timezone
I'm working with an API that returns time values in the following format:
2013:02:27T06:39:25
Note the lack of any identifier for timezone.
From the API Docs:
...
0
votes
2answers
24 views
Undefined error in MEAN CRUD
{ text: undefined,
done: false,
_id: 529e16025f5222dc36000002,
__v: 0 }
PUT /api/todos/529e16025f5222dc36000002 200 142ms - 68b
I keep getting this error when trying to do an update for my ...
0
votes
1answer
19 views
Socket.io check if there are connections
I want to run a task every some seconds (2-5) then broadcast the result to the clients, the task is making an api call and then calculating somehow the returned data. Running the task without clients ...
1
vote
1answer
23 views
Hashing an email (or username) to store in redis hash buckets
I am writing a node.js application that relies on redis as its main database, and user info is stored in this database.
I currently have the user data (email, password, date created, etc.) in a hash ...
0
votes
2answers
38 views
How do I call a method in a routes file from a public javascript file?
I'm playing with a template using mongoose, express, node and mongodb. There is information passed from jade to mongo through forms, but I'm attempting to send HTML to mongo after a jQuery function ...
0
votes
1answer
31 views
How can i ensure this loop runs as expected in node.js
The following code outputs the port number 40001 twice, then exits with error:
Error: listen EADDRINUSE
I believe this is because the code is asynchronous and does not wait for one whole iteration ...