What is the best way to debug Node.js with ease

Simpel task: like Express app or CLI app on local machine After I try node-inspector and that not work very well by now . and the debugger of webStorm stop working properly for me. and visual studio code work some time but the debugger not mature eno

How to import a module in Node js

I have two js files: MyBreakdown.js and MyService.js and I want to import the second one into the first one. There are in different subfolders of the same directory, like this: server/reports/plan/MyService.js and serer/validation/rules/sections/MyBr

LoopBack LCD does not work

I created a model MyUser inherited from LoopBack User model. In boot script I created a user in MyUser model, custom role and mapped that role to it. But the ACL is not working after assigning in MyUser.json file. Bootscript.js 'use strict'; module.e

Query a result returned by mongoose in nodejs

I am relatively new to Node.js, Mongoose and MongoDB. I want to perform filter functionality and want to filter products by criteria selected by the user. Is it possible in Node.js to query a response returned by Mongoose? Sample response from Mongoo

Node.js random number generator?

This is for a Twitch.tv chat bot when someone types !random, it would reply with a random number between 1-100. I've tried var p1 = Math.floor(Math.random() * 100); but i'm not sure how to integrate that into the code below in the client.say("")

Access to node.js modules in a webview tag

I have a nw app which loads index.html Within index.html I have a <webview> tag which loads external.html In index.html, executing var fs = require('fs') succeeds, whereas executing the same in external.html fails. So node.js modules are exposed to

Why would a NodeJS / Restify * server rarely report EPERM?

I'm running a restify server in NodeJS. On very rare occasions, on the order of 0.05% of HTTPS requests cause net.js to report the following error: Error: accept EPERM at exports._errnoException (util.js:742:11) at TCP.onconnection (net.js:1280:24) T

gulp-filter filters all

gulp-filter is filtering everything. I'm trying to use gulp-filter to exclude a single file from gulp-uglify: var uglify = require('gulp-uglify'); var filter = require('gulp-filter'); var paths = { css: 'src/*.css', html: 'src/*.html', js: 'src/*.js'

Node / NPM / Grunt failing on jscs (grunt-jscs)

I have a grunt task that runs JSCS on a javascript code base and it was working until it came time to integrate with the build server which is using latest, stable versions of grunt, npm/node. This all ran fine under npm 1.XX.X but after i upgraded t

What is the javascript `emit` function?

While looking through sax nodejs module, i saw multiple emit function calls, but i can't find any information about it. Is it some V8 native tool for emitting events? Why sax-js do not use EventEmitter for streams then? Please look at line number 624

Get rid of node-jsx

In the router of my NodeJS app, I want to render a react app. As it is not browserified (and there reactified) it returns unexpected token < error while building. I found if I require("node-jsx").install() it doesn't return me this error. But

fill in an array with a callback from async.series

My callback function in 'async.series' returns several values and creates several outputs from 'elements'. How can I write the return values into an array by using 'forEach'? async.series( { // Browse elements: function(callback) { Server_browse(item

How can I require the module in my file?

I create an express project and the directory structure like: / - model db.js - routes users.js app.js In ./model/db.js, I have a MySql connection: var mysql = require('mysql'); var connection = mysql.createConnection({ host : 'localhost', user : 'ro

Sending GCM push in the node

I've got problem with sending message to Google Cloud Messaging by Node application. I've created API key (both server and browser), I've whitelisted in server key server IP and by code var headers = [ 'Content-Type: application/json', 'Authorization

Simple node object object module

So I have a node application that makes use of MQTT. I want to encapsulate all my MQTT client creation logic in a single place to ease refactoring. I wrote a moudel that looks like the following: var mqtt = require('mqtt') , host = 'localhost' , port

Node.js Download file using content layout as file name

I'm using the Request module to download files, but I'm not quite sure how to pipe the response to an output stream when the filename must come from the 'Content-Disposition' header. So basically, I need to read the response until the header is found

mqtt messenger.client javascript nodejs

i'm new to mqtt messaging client in javascript. can any one say that this code is written in client side or server side. client = new Messaging.Client(location.hostname, Number(location.port), "clientId"); client.onConnectionLost = onConnectionL

nodejs variable instantiation in a callback function

I have a script in nodeJS that connects to my postgres DB, the issue is that on a callback method I'm initiating a variable but it seems always empty, this my app.js script : var ck_username = /^[A-Za-z0-9_]{1,20}$/; function fncCheckUsernameAvailabi

Counting socket.io users on horizontal servers

I have multiple socket.io servers scaled horizontally using a redisstore. I've got rooms setup effectively and am successfully able to broadcast to rooms across servers, etc. Now I'm trying to build a status page and what I'm failing on figuring out

Returns the analyzed output of the file from node.js

I have my file reading in and being parsed properly but I can't seem to return the string of output. I would like to be able to access this string from a variable that it gets assigned to on the client. I'm using async series to help alleviate callba