Tagged Questions
Node.js is an event-based, non-blocking, asynchronous I/O framework that uses Google's V8 JavaScript engine.
0
votes
0answers
9 views
Strange issue, model.find undefined in mongoose
My model is
user.js
module.exports = function (mongoose) {
var schema = new mongoose.Schema({
name : String,
emailAddress : String,
lastActivity: { type: Date, ...
0
votes
0answers
6 views
Failed to load c++ bson extension with windows
I know this has been asked many times but I still get this after installing mongoose on Windows 8. I don't even see anything bson related in this path:
...
0
votes
0answers
3 views
nodeJS Agenda - jobs do not run after restart
After defining and setting up several jobs to run at intervals, they work fine. If the job if killed and restarted, the jobs are still in the agenda collection but they do not continue running. Do ...
0
votes
0answers
9 views
the memory distribution of nodejs
When I start a new nodejs and type process.memoryUsage(), it shows
> process.memoryUsage()
{ rss: 11296768,
heapTotal: 7195904,
heapUsed: 2964776 }
so the nodejs uses the 11M memory and v8's heap ...
0
votes
0answers
5 views
How to include required files in Istanbul that are not in same directory as test case?
I'm trying to do something simple, but it's not working.. I must be doing something dumb.
I am using Istanbul with Mocha for code coverage + unit testing.
In the code being tested, it is using ...
0
votes
0answers
9 views
npm install causes errors like npm ERR! tar.unpack untar error on Debian
Installing Grunt as in the Bootstrap documentation shown, I first installed grunt-cli globally with npm install -g grunt-cli and now I'm trying to execute npm install, but only getting errors:
...
2
votes
3answers
15 views
Node mocha array should contain an element
I want to do a simple assertion of something like
knownArray.should.include('known value')
The array is correct, but I simply can't figure out the proper assertion to use to check whether the array ...
0
votes
0answers
8 views
Efficient Ruby and Node.js communication/IPC
I have a main Node.js API application that needs to generate a PDF file, the only mature PDF generator is Prawn PDF, which is written in Ruby.
I basically need to spawn a Ruby process from Node.js, ...
0
votes
2answers
19 views
At what number of columns should you make another table?
I had a table that nearly reached 20 columns.
I find each one necessary since it's a "project" table, and the project has columns that indicate stuff such as when it was created, when it was ...
0
votes
1answer
7 views
How to access the target socket in a Socket.io handler
I'm working with a Socket.io server and I'm trying to access the socket that emitted the event from the client.
There's this example in the docs :
socket.on('private message', function (from, msg)
...
0
votes
1answer
11 views
Possible to populate two levels?
Say I have collections/documents like below:
question collection:
{
_id: ObjectId("0000"),
title: "test question",
survey: ObjectId("1234") //abbreviated for question assume this is a legit ...
0
votes
0answers
22 views
MEAN with mySQL
I'm trying to learn angularjs and I want to use mySQL instead of MongoDB in my MEAN stack. Coming from a LAMP background, I am having trouble understanding the organizational/functional structure of ...
0
votes
0answers
18 views
Node base64 encode doesn't give whole string
Good day,
I am having a weird issue with Node, I am encoding a file as Base64 and albeit it works for most of my PDFs that I am encoding, one in particular doesn't output the whole base64 string.
...
0
votes
0answers
10 views
npm forever equivalent in rails?
With node, I can use forever to keep a process running forever. What's the most popular equivalent in rails?
I'm trying to avoid any overly complex or expensive setup right now so I'm really looking ...
0
votes
1answer
8 views
Node Cannot pipe pdf response
Trying to write a test (mocha) to check that the PDF returned from my api endpoint holds the correct data and looks like it should. The PDF is generated on the sever. It returns 'corrrectly' when hit ...
0
votes
0answers
3 views
CouchbaseError: Client-Side timeout exceeded for operation
I am running couchbase server 3.0.1, with NodeJS SDK. I have set up a server with two buckets, and no documents. I opened a connections via:
var dbCluster = new couchbase.Cluster([my_host]);
var db ...
0
votes
0answers
3 views
Multi schema XSDs node-soap
This may be on the same lines as this:
node-soap multiple import schemas
But I coudnt find the fix.
I have a WSDL which refers to one XSD and this XSD refers another one.
Parent.wsdl --> a.xsd ...
0
votes
0answers
11 views
HTTPS using a .pfx file
var https = require('https');
var fs = require('fs');
var atob = require('atob');
var options = {
pfx: atob(fs.readFileSync('server.pfx').toString())
};
https.createServer(options, function(req, ...
2
votes
0answers
12 views
socket io not found - 404
I ran into this error when following a tutorial about creating a chat service. Here is the code: (most of it is automatically generated)
var port = normalizePort(process.env.PORT || '3000');
...
-1
votes
0answers
7 views
How configure jshint in a meanjs project with socket.io?
I followed exactly that tutorial (I obviously replaced the vexxhost domain name by localhost:3000 for my tests).
And while calling grunt there is an error ('io' is not defined) but the server start ...
0
votes
2answers
35 views
NodeJS Variable Scope
I'm very, very new to the whole NodeJS stack, and I'm trying to rough up a simple login system for practice.
Jumping to my question,
app.js
...
var mongoose = require( 'mongoose' );
var templates = ...
0
votes
1answer
14 views
TypeScript / NodeJS: variable not defined, using internal ref paths for separate files
I have been testing typescript with node, all was going well until i tried splitting these out.
Am I forced to use modules ?
I have 2 files, app.ts which has a reference path to the hellofile.tst
...
-4
votes
0answers
10 views
Control telepresence robot w/ xbox controller smoothly
I'd like to control my outdoor telepresence robot with an xbox 360 controller via my Node.js application that uses JQUERY to capture keyboard commands.
Right now, I'm controlling it by clicking up, ...
-1
votes
0answers
15 views
How to connect and use the database correctly (MySQL) in Express/Node JS?
I'm new to Javascript and Express framework, so I don't have much understanding of how it works. Here is the code and decribed below:
database.js:
var mysql = require('mysql');
var connection = ...
0
votes
2answers
28 views
Issue exporting module NodeJS
I have this directory structure:
app/router.js
app/oauth2-home-client/oauth2-client.js
And the sources:
app/oauth2-home-client/oauth2-client.js
//SOME CODE
exports.Bearer = {
...
0
votes
0answers
8 views
Node.JS + WebSockets + Express: Download File
Ok, so, yeah. I have the following server.js file with a web server + WebSocket implemented and, I was wondering, could I send file content through my WebSocket, and then using Express, create and ...
0
votes
0answers
5 views
Node Inspector opens different file for breakpoints
I, cannot for the life of me, figure this one out.
Steps I took:
Run node-inspector
Run node --debug server.js
Navigate to http://127.0.0.1:8080/debug?port=5858
Assign a breakpoint
Run a command
...
0
votes
0answers
24 views
Node.js HTTPS request using Elliptic Curve key
I want to build an HTTPS client that connects to a HTTPS Server that requires mutual authentication. Additionally, the client key is an Elliptic Curve key instead of a RSA key. To support Elliptic ...
0
votes
0answers
16 views
Cannot add new record to database using mongoose and node.js
I'm trying to update the records of a data base from an uploaded csv file using mongoose and node.js.
The problem is I keep getting
TypeError : undefined is not a function
At this line of code
...
0
votes
1answer
9 views
Trying to create negative nodejs (npm) long values
Below, Long.NEG_ONE produces the desired results. What is the alternative way to construct a Long object using a negative value?
https://www.npmjs.com/package/long
coffee> l=new Long "20000"
{ ...
0
votes
0answers
5 views
New Relic/Node.js CPU Issue
We've just started up a New Relic membership and are trying to integrate with our Node.js/Express4 application. Reading through the instructions found here seemed very straight forward and we have ...
-1
votes
2answers
34 views
Node: 'Best Practice' of js files using other js files
Here is the scenario:
Main.js:
var one = require(./one.js);
var two = require(./two.js);
two.foo();
one.js:
module.exports = {
foo: function () {
console.log("this was called by two");
}
...
0
votes
2answers
23 views
Mongoose update with limit
I am looking to update X documents all at once. The short is I basically need to randomly select N documents and then update them as "selected". I'm trying to design an API that needs to randomly ...
0
votes
1answer
19 views
Structuring backend queries
So this is more of a methodology question than a coding question. I want to ask this before I actually start coding in order to choose the best route. I have a messaging app. When the app launches I ...
1
vote
1answer
40 views
Why does my call back function not run?
var user_col = db.collection('users');
var cursor = user_col.findOne({email:'[email protected]', password:'test'}, function(err,doc){
console.log("THIS IS A TEST");
});
The problem ...
0
votes
1answer
20 views
How to read files in directory in node.js?
In my node.js app, I load modules from a folder, and put them in an array. Right now I do it manually like this
var sitesList = [
require('./js/sites/A.js'),
require('./js/sites/B.js'),
...
0
votes
1answer
9 views
create plist file using javascript
How to create a plist array's item using node.js or any javascript code ..
I have a function that reads json and converted it to plist,
function featuresPlistEntries(data) {
var ...
0
votes
2answers
26 views
Getting started with hapi js
I am looking at making a simple hello world with the hapi.js tutorial.
I have installed happy-
npm init
npm install hapi --save
I get a large set of folders with files
I tried doing node index.js ...
0
votes
2answers
30 views
Call function in JS file from Node.js
What I am trying to do is when index.html sends a message back to the server, I want to call a function in app.js called changeButton() that will update a header color on index.html.
Here is my ...
0
votes
0answers
3 views
iFrame AD causing mobile slideshow swiping to break in safari
My mobile slideshow has an ad refresh function every time the you swipe through the slideshow - once the google iframe popups and you x out the ad, swiping seems to disable. It seems when I swipe it ...
0
votes
0answers
8 views
How to test a cross-domain chatting Web application on a local server (localhost)?
Built a cross-domain chatroom Web application using CORS (Cross-Origin Resource Sharing), with Node.js + Express.
Its main feature is supposed to be sending and receiving messages from different ...
0
votes
0answers
12 views
Dynamic attach event to socket (socket.io)
In this example code "offer" event transmits some data from one client to another through server. Although, it doesn't works now)
//server side
var ioSpace = io.of('/channel_name');
...
0
votes
0answers
10 views
How to use readFileSync inside nodeJs vm
I'm experimenting with nodeJs vm. This code works :
server.js
var fs = require('fs');
var vm = require('vm');
var app = fs.readFileSync(__dirname + '/' + 'app.js');
...
0
votes
1answer
13 views
Mongoose Save Into Database : No Error
I sticked basically to this tutorial (http://mongoosejs.com/docs/index.html), but I neither get an error nor does it change anything in my database.
The code:
(function() {
var configDB, ...
0
votes
0answers
13 views
error log on npm start
I know there is a lot of questions about that but I can't resolve it by myself, because I'm not sure about what the error log talks about.
Here it is:
0 info it worked if it ends with ok
1 verbose ...
0
votes
0answers
12 views
Swagger-node-express usage
I'd like to share my thoughts about https://github.com/swagger-api/swagger-node-express
It has 564 stars on Github, so I think it is justify to use it, but:
Why should I use methods like ...
0
votes
0answers
28 views
Testing promises and sync functions that throw errors
I'm trying to build and test a function at the same time. Testing makes sense and I love it in theory, but when It comes down to it it always is a pain in the behind.
I have a function that takes a ...
1
vote
0answers
10 views
Node.js Kue - Pause workers in app with multiple instances
When using kue in an app that has multiple instances (say multiple containers in docker) that all use the same redis database, if you pause a worker, do you need to pause that worker on all instances ...
0
votes
0answers
3 views
Set up openbadge badgekit - “npm install client-sessions” fails
I'm looking to set up open badge badgekit, I've got the API side of things up & running but I'm having trouble getting the web app to function.
It seems I'm missing a node module dependency ...
0
votes
0answers
6 views
Not setting condition properly in EJS template in MEAN stack
Following is my code which is not outputting when I am setting condition to avoid error if object is undefined -
<% if((typeof orderData.shipper !='undefined') && (typeof ...