Node.js is an event-based, non-blocking, asynchronous I/O framework that uses Google's V8 JavaScript engine. It is used for developing applications that make heavy use of the ability to run JavaScript both on the client, as well as on server side and therefore benefit from the re-usability of code ...

learn more… | top users | synonyms (2)

0
votes
0answers
2 views

sails js passport serializeUser field

I'm making an sails js app that authenticates users with passport for authentication and i need to change serialize field instead of 'id' to 'userid' my model.js : id: { type: 'integer', ...
0
votes
1answer
10 views

javascript define a constant global

In my project I encode some information in an array. The number 0 represent one thing and the number 134 another and so on. a few different modules use thees numbers. To help with readability I define ...
0
votes
0answers
4 views

Node / child_process throwing E2BIG

I have a fairly simple C++ program which only takes one argument that is a Base64 encoded string. I can call the program I am now trying to call this program using node's child_process.spawn() but it ...
0
votes
0answers
5 views

Including Model in Controller : Node.js / Express / Mongo app

I am making a simple app. I am not able to start >node app.js I get the following error below. I have searched quite a bit and did jslint to make sure all the braces are closed. The node app starts ...
0
votes
1answer
10 views

MongoDB won't return correct data first time round

This is my code: // Modules var mongodb = require('mongodb'); var MongoClient = mongodb.MongoClient; var url = 'mongodb://localhost:27017/affinity'; window.$ = window.jQuery = require('jquery'); var ...
1
vote
1answer
8 views

How to add multiple pages in node js

I want to create a login and registration page for a web application. I have been using this tutorial: https://thinkster.io/mean-stack-tutorial However, I want to modify it so everything is ...
0
votes
0answers
5 views

Prevent attributes from being returned in sequelize includes

I need to conditionally exclude an attribute from eager loaded model in Sequilize The query looks like this Model.findAll({ include: { model: Association attributes: ['atr'] ...
0
votes
0answers
8 views

React v15.0.0: Since that renderToString is deprecated, how to go about server-side rendering?

There is a new release candidate of React, v 15.0.0. Since the renderToString method now is deprecated in the library, and apparently is going to be discontinued in future versions, what is the way to ...
0
votes
1answer
3 views

Uploading files to server using Filezilla

I have successfully logged in to the OpenShift server of my account using SFTP in Filezilla. But am unsure where to upload my nodejs project files! Please find the directory structure: So where ...
0
votes
0answers
10 views

How to npm publish Node.Js + Java

I am using java module to call my java classes from node.js script. It is not working when I publish it as npm module. I am importing java classpath as java.classpath.push('target/classes'); Does ...
0
votes
0answers
10 views

Display data with Jade: MongoDB + Monk + ExpressJS

I'm trying to show some data from my MongoDB database on the client side, but I keep getting the following error: 8| li 9| #{victim.first-name} > 10| Cannot read property 'first' of undefined I've ...
0
votes
1answer
8 views

Link server with PG RDS from AWS

I am trying to get the React-fullstack seed running on my local machine, the first things I want to do is connect the server with a database. in the config.js file there exists this line: export ...
0
votes
1answer
6 views

How to retrieve schema from a mongoose collection?

using this line : var collection = mongoose.connection.db.collection("users"); I get users s collection, now i need to get the schema from that collection ? Is there a way to do this? thank you. ...
0
votes
0answers
7 views

Sublime Text: use Node from nvm for build

I'm using Sublime Text 3, and Node is installed locally through nvm. How can I create a JS build so that it automatically uses the current or default Node version alias from nvm? Currently my ...
2
votes
1answer
16 views

Need a way to systematically handle errors/exceptions/rejections in a NodeJS project

Background Info I have a new project I'm working on that will provide multiple different (optional) packages that can be installed, all of which are in addition to the core package (only manual ...
2
votes
0answers
7 views

RTS HTML5 game multiplayer node.js architecture

I made a RTS game with HTML5 (with create.js) and want to add the multiplayer part with node.js. I can convert the html and javascript file as .exe to run the game as a "normal" application with ...
0
votes
1answer
13 views

Can't send file using res.sendFile to OpenShift

I'm trying to send a file using express in NodeJS server. On localhost it works, but when I push my application to OpenShift, I have an error: Internal Server Error. Code: var path = ...
1
vote
0answers
17 views

Error: write after end

I'm receiving the following error when using the drive.files.update method of the google-api-nodejs-client Error: write after end at ClientRequest.OutgoingMessage.write (_http_outgoing.js:422:15) at ...
2
votes
0answers
12 views

Extending a .d.ts module that is also a function

I'm attempting to extend (from definitely typed) locally: gm/gm.d.ts The module is a function as well as a namespace, and I need to add an additional invocation of the function. I want to extend the ...
0
votes
2answers
12 views

Node.js get pid at port

In Node.js, I want to kill a server running on port 1337. process.kill(pid) seems like the way to do that. But how do I get the pid of the server running on port 1337, in Node.js? I see plenty of ...
0
votes
1answer
11 views

To post data with cookie using node.js

I post some data to a url. This is my code. request = require("request"); var url = "http://www.cjihrig.com/development/php/hello_cookies.php"; var jar = request.jar(); var cookie = ...
0
votes
1answer
18 views

Simple Way to Implement Server Sent Events in Node.js?

I've looked around and it seems as if all the ways to implement SSEs in Node.js are through more complex code, but it seems like there should be an easier way to send and receive SSEs. Are there any ...
0
votes
2answers
10 views

Does readFile caches the content?

Say I have: var fs = require('fs'); var a= fs.readFile(__dirname + '/someBigFile.txt', function(err, data) { console.log(data); }); I've noticed that, if it first takes, say, 2 seconds to read ...
0
votes
1answer
24 views

How do you access exported functions from within each other?

I have a constructor and a function like function Node(args) {} function tree(args) { new Node(args) } Now i need to use the tree() function in an another file so i guess module.exports = { ...
0
votes
0answers
30 views

Sherlock and the beast - Hackerrank

I have written this code in javascript for this hackerrank challenge: function main() { var t = parseInt(readLine()); for(var a0 = 0; a0 < t; a0++){ var n = parseInt(readLine()); ...
0
votes
0answers
5 views

install a flat theme for terminal does install it permanently

I would like to install a flat terminal theme like this using npm or by cloning the repo (I tried the two solutions). It works well, but when I restart my ubuntu system, I have to re-install again ...
0
votes
0answers
3 views

Loopback server.js get user id

How do I get user has logged In or No in server.js? How do I get user ID and user information in server.js? Thank you
0
votes
0answers
10 views

Error installing elementor

I am trying to install elementor(npm install -g elementor as admin) but I am getting a series of errors like: gyp ERR! build error gyp ERR! stack Error: ...
1
vote
1answer
17 views

Parse remote DOM in JS

I want to get the DOM of a remote web site and be able to parse it, i.e. ideally to convert parsed result into a DOM nodes and effectively grab desired elements from it and later process them. Namely ...
-1
votes
3answers
17 views

Using a generator to call an API multiple times and only resolve when all requests are finished?

I'm making a simple NodeJS app and I'm refactoring it out of my callback hell. I've realised generators could be used but I'm struggling to grasp exactly how to use them. Here's the basic flow of my ...
0
votes
0answers
8 views

Install Aptana Studio 3.6.0 on Win 7

I am trying to install Aptana Studio 3 on a Windows 7 OS. I initially had the common node.js error prevent the installation. I then downloaded node.js but the wrong version. Removed node.js and ...
-1
votes
0answers
18 views

Can anyone tell me why this is adding only one object, using mongoose

I would like to add a new object into my mongoose schema each time there is a match but it does not seem like adding. It is only adding one object for each student, instead should add everytime there ...
1
vote
1answer
19 views

How to print html source to console with phantom-crawler

I just downloaded and installed phantom-crawler for nodejs. I copy and pasted the following script into a file called crawler.js: var Crawler = require('phantom-crawler'); // Can be initialized with ...
1
vote
1answer
23 views

Delete last N bytes in a large file in node.js

I am looking for a way to delete the last few bytes in a large file in node.js without buffering the entire file into the memory and saving it. Is there any way to do this? Edit: By "last few bytes" ...
0
votes
1answer
12 views

How to connect to MySQL using NodeJS server in OpenShift?

I'm trying to connect to MySQL database in OpenShift using Node JS server. And I have an error: Error: connect ECONNREFUSED 127.0.0.1:3306 at Object.exports._errnoException (util.js:870:11) ...
0
votes
0answers
6 views

error in custom yeoman generator “You don't seem to have a generator with the name scotchmeans installed.”

I created custom yeoman generator following below link. https://scotch.io/tutorials/create-a-custom-yeoman-generator-in-4-easy-steps i've done all the required steps when i use npm link in the node ...
0
votes
0answers
10 views

Developing Node Client and Server Simultaneously?

I've been developing a front-end application using Node - React / Redux and Webpack. How would I go about developing the client and server API side by side; I would like to continue using ES6 for the ...
3
votes
2answers
30 views

Why Send API Status Codes?

I'm building my first API with node.js and was wondering do I need to ensure that a status code is send with every response or is it ok to simply use a boolean. Is it critical for security or ...
-1
votes
1answer
29 views

string concat replacing second string arg too, possible es6 issue

I am writing code to create a chess board in es6 for a nodejs project const XPOSITIONS = [{ "name": 'a', "index": 0 }, ...
0
votes
1answer
26 views

Node.js long term tasks

I have a node.js server which is communicating from a net socket to python socket. When the user sends an asynchronous ajax request with the data, the node server passes it to the python and gets data ...
-3
votes
0answers
28 views

How to allow jQuery to consume service cross-domain in express?

I have a simple (demo actually) web app with express. I am replacing angular (so, it is the whole mean stack really: mongo, express, angular, node.js) with a jQuery front-end as an exercise. So yea, ...
0
votes
0answers
29 views

node app.js command does not work in ubuntu terminal

I am using ubuntu. I installed nodejs. i created a rest api using node. app.js is the file which has the code. var express = require('express'); var bodyParser = require("body-parser"); var app = ...
-1
votes
1answer
24 views

Random Binary in JavaScript/Node.JS

I am trying to find the fastest way of generating a random binary string of a certain length. As in, a certain number of random booleans. Here's my current code - is there a much faster way? ...
-2
votes
0answers
17 views

NodeJS + Socket.Io or ActionCable?

I am trying to create a real-time app right now and I'm tossing up between Rail's newest feature in ver.5 ActionCable and node.js + Socket.io. If I wanted to analyse chat messages in real-time, which ...
0
votes
0answers
11 views

Merge array of two documents in Mongoose

I have following schemas in the app var UserSchema = mongoose.Schema({ email: {type: String, index: {unique: true, sparse: true}}, password: String, createdOn: {type: Date, ...
0
votes
1answer
18 views

nodejs: Keep within a proxy server

I am following this code sample to create my own CORS-proxy server. It works fine but when I click a link, I go to an invalid link. Say, I loaded localhost:1377/?url=www.github.com in my server, ...
-1
votes
0answers
12 views

Unable to load angular controller file while running server side using nodejs

when the controller code is written in the same html file, code works. But as soon as I separate the controller code into myController.js file and mention the js file in the src attribut I get an ...
1
vote
0answers
14 views

Cannot find module 'xmlbuilder' when building ionic app

When i executing ionic start myApp tabs i am getting below error Error: Cannot find module 'xmlbuilder' at Function.Module._resolveFilename (module.js:325:15) at Function.Module._load ...
0
votes
0answers
9 views

Socket.IO emit from client and get a response from Node server

I am using Socket.IO and I got the one-way idea quite well, but what if I want to emit an event from the client, then get the data from the server and return a response to the client? Is there any ...
0
votes
0answers
15 views

socket.io - how to reconnect between different ports/servers on one socket

I'm trying to make a live logging on website of my 2 node apps. The point is that even after disconnecting,closing or even destroying previous socket, it's events are still on. It results with ...