Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world.

Share tech news, updates, or what's on your mind.

Sign up to Post


great to learn on because code editor is provided and examples are short

is there another so I can become a better beginner
not looking for 500+ characters code samples where i create entire websites
Learn how to optimize MySQL for your business need
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

I have some cluster warnings after running the cluster validation wizard in my test environment on Virtual box Environment.
I have 2 Server (SQL-E and SQL-F) and 1 Domain Controller Server I should able to ping each other:
node1 -

node 2

both nodes connected to DC server( = iscsi target which is Domain controller Server)
When I validate to create the cluster. Now i receive 2 warning:
validate ip configuration
validate network communication
Going to "validate ip configuration" i see on both nodes a Local Area Connection 11 with an APIPA 169 address but looking on both servers i don't see this Local Area Connection 11 in network sharing center.
QUESTION1: How do i solve the below Error?
Going to "validate network communication" i see the warning below:
--node1 and node2 are connected by one or more communication paths that use disabled network. These paths will not be used for cluster communication and will be ignored. This is because interfaces on these networks are connected to an iscsi target. Consider adding additional network to the cluster, or change the role of on or more cluster networks after the cluster has been created to ensure redundancy of cluster communication.
--the communication path between network interface node1-nic1 and network interface node2-nic1 is on a disabled network.

This is driving me mad and I tried to ping back and forth with all servers. i should be able to reach. I do not have any clue to …
What will be the omnirpt command to get the list of all tapes used for the backup of a node?
-------my code-----

import xml.dom
import xml.dom.minidom
doc = xml.dom.minidom.parseString('''
   <person id="01">
      <name> abc</name>
   <person id="02">
      <name> def</name>


def innerHtml(root):
    text = ''
    nodes = [ root ]
    while not nodes==[]:
        node = nodes.pop()
        if node.nodeType==xml.dom.Node.TEXT_NODE:
            text += node.wholeText
    return text

for statusNode in doc.getElementsByTagName('person'):
    for childNode in statusNode.childNodes:
        if childNode.nodeType==xml.dom.Node.ELEMENT_NODE:
            print("{}={}".format(childNode.nodeName, innerHtml(childNode)))

-------------output i got is------------------
name= abc
name= def

---------but expected output should be in tableformat-----
i need to get the person id attribute also...pls answer

person id         name         age      address
01                abc          32      addr123
02                def          44       addr456
We have  hosted  a UI application using Node js on AWS Elastic beanstalk in production environment . Because of minimal 1 to 5 % 5XX errors the EC2 instances keep going into degrade and then warning state. This is happening for very few minutes time interval. After sometime EC2 instance goes into normal state.  How to configure the threshold for 5 xx error so that we cannot see the server into degrade or warning state.
I'm using one of the free Wordpress themes 'SELA'.

On this page I want the lower iFrame (the multitrack player) to extend across the page. At the moment it is restricted, even though the page template is called 'Wide Page'. The width of the iFrame is set to 1200px.

These seems to be a restriction on the theme that prevents a full width iFrame. How can I get round that please?
I'm trying to understand how this works so that I can make a few small tweeks.

When the page opens a dropdown list is populated, and a song selection can be made.
I can see that a Function loadSong(songName) { ...} is fired off at that point. (it is in sounds.js)

I have found that I can force the song by doing this on line 342
currentSong = new Song("Londres Appelle", context);

Open in new window

"Londres Appelle" is a song in the demo list.

My question is, would it be possible to force a 'song' in this function by using a URL parameter?
eg."Londres Appelle"

My background: JavaScript and Node.js newbie. Worked extensively with Classic ASP and VBScript back in the day  (2001-2003). I understand using QueryString to pass a variable to a page, but I don't know if I need to think differently in Node.js.

Hello I want to change my node location from "TOP" to "warehouse". Can someone please tell me the command?
Hi all

The UI for my react app has a main section (takes up most of the screen) and a left hand side pane.
I'm using 3 separate ag-grids:
-One as the main one on the main screen holding the important data.
-the other two are in the left hand side pane (the less important grids for assistance/statistic holding).

This left pane uses (two) tabs, i.e. click on one tab to see one ag-grid, click the other tab to see the other ag-grid

For the tab functionality, i used npm to install the NPM react-bootstrap-tabs node module.

Recently I managed to set up one of the left pain ag-grids to hold filtering information from the main grid.
This was quite a hassle since the grids were effectively grand-sibling components which needed to communicate. without touching AG-grid src code, I had to set up ag-grid callbacks to take note of the filtering data from the main ag-grid, send it up to the grandparent component of my app, and then send it back down to the other grand child ag-grid component.

It all works however I noticed a glitch. When initially loading the whole page, the first tab in the left pane is active by default. The left pane ag-grid that holds the filter information is in the second tab. What I want is to click on this second tab, and see filter data be populated automatically as i filter the main ag-grid. However when I have the second tab active and i filter the main ag-grid (i.e. adding filter …
Hello nodejs experts

Is there is anything more on node js standards?  

All urls must be in lower case

Ex: /notification/sendotp

Use HTTP verbs (GET, POST, PUT, DELETE) to operate on the collections and elements.

Use GET – for retrieving single or list data

Use POST – for create data

Use PUT – for update data

Use DELETE – for delete data











URLs should include nouns, not verbs in API names. Avoid get,update,save, delete, list in API names.

Maintain singular and plural nouns for APIs.

Ex: for single image retrive – GET - /user/image

For list of images – GET – user/images

User Token must be in headers only. Not as path param or in json body

Use resource, sub-resources for relations

Ex: for user videos use - /user/videos

Put the version number at the base of your URL. /v1/user/images

Controller will have only mandatory parameter validations and sending success, error responses no business logic. Use Service and Helper files for business logic. DAO for db calls

Handle Errors with HTTP status codes

200 – OK – Everything is fine. Created, Saved, Data found

400 – Validations Failed, Missing Mandatory Params, No data found, User already exists, already voted, in valid comment, comment not allowed within a hour, invalid user, invalid video, Video not found

500 – Unknown error, Database error, ES down, timeout from third-party. …
Moving data to the cloud? Find out if you’re ready
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

I'm trying to setup a new webrtc instance behind the firewall where tcp 80 and 443 ports are only available.
All is fine as long as udp ports are enabled. Once I block udp, I can't establish a client connection.
The stun/turn server has been setup however connections are not redirected from webrtc.

RTCMultiConnection.js config:

var IceServersHandler = (function() {
        function getIceServers(connection) {
            var iceServers = [];
iceServers.push(getTURNObj('', 'user', 'pass'));
            if (window.RMCExternalIceServers) {
                iceServers = iceServers.concat(getExtenralIceFormatted());
            } else if (typeof window.getExternalIceServers !== 'undefined' && window.getExternalIceServers == true) {
                connection.iceServers = iceServers;
                window.iceServersLoadCallback = function() {
                    connection.iceServers = connection.iceServers.concat(getExtenralIceFormatted());

            return iceServers;

        return {
            getIceServers: getIceServers

turnserver.conf config


All is running in AWS cloud.

I am learning Angular, Node, npm, deployd, mongodb, etc.  I am making my way through a book titled "Pro AngularJS" by Adam Freeman.

on page 120 I am attempting to prepare the data for a "real world" application called "sportsstore".

I was instructed to install a module called "deployd" which apparently is used for modelling  API's for web applications.

I did that and when I try to start start the "deployd" service I get an error:

C:\PROGRA~2\deployd>dpd -p 5500 sportsstore\app.dpd --mongod
starting deployd v0.8.9...
  var err = this._handle.spawn(options);

TypeError: Bad argument
    at TypeError (native)
    at ChildProcess.spawn (internal/child_process.js:289:26)
    at exports.spawn (child_process.js:380:9)
    at Object.exports.restart (C:\Users\knowlton\AppData\Roaming\npm\node_modules\deployd\lib\util\mongod.js:38:14)
    at Command.start (C:\Users\knowlton\AppData\Roaming\npm\node_modules\deployd\bin\dpd:149:16)
    at Command.listener (C:\Users\knowlton\AppData\Roaming\npm\node_modules\deployd\node_modules\commander\index.js:301:8)
    at emitOne (events.js:96:13)
    at Command.emit (events.js:188:7)
    at Command.parseArgs (C:\Users\knowlton\AppData\Roaming\npm\node_modules\deployd\node_modules\commander\index.js:617:12)
    at Command.parse (C:\Users\knowlton\AppData\Roaming\npm\node_modules\deployd\node_modules\commander\index.js:458:21)
    at Object.<anonymous> 

Open in new window

I have to write a Node.JS application that connects to a remote server.  The remote server has a login manager that authenticates my session then spawns a separate process to handle the rest of my session.  The way that works is that I have to make a non-SSL network connection to the login manager and do an initial unprotected handshake.  The lets the client and server negotiate if they will be doing SSL or plain text communications.  If SSL then I need to elevate my socket to an SSL socket, send my login and password along with some other initial information, then get a success of failure message back from the login manager.  If success then I know the login manager is starting a new process and handing off my open socket connection to that new process.  Since the server can't pass the SSL context it de-elevates the SSL connection and runs a program passing it the non-SSL open socket.  Then the new program creates it's own SSL context on the open socket. So in my Node.JS code I need to close the SSL socket but leave the raw socket open.  The new program will send me a success message when it is up and running at which time I need to re-elevate my open socket to SSL again.

My question is how can I close an SSL socket leaving the raw socket open so I can continue to use the raw socket and then re-elevate it to SSL again?
I have a node.js module that needs unit test. Here is the key relevant code:

old code:
                const memsqlPool = {
                    execute: sandbox.stub().resolves(!mockPara || mockPara.memSqlResult || ''),
                sandbox.stub(my-lib.memsql, 'Pool', constant(memsqlPool));

In the source code:

const {memsql} = require('my-lib');
const memsqlPool = new memsql.Pool(my-config);
        function getInfo(id){
            return memsqlPool.execute(my-arguments).then(my-mapping-object);

This code actually hints that memsqlPool.execute() can only be called once in any given test case, because it always returns the same results.
Now I have to make two memsql calls, one depends on another.  I try to make it something like:


But just do not know how to fit this idea into the unit test code above.

Anyone can help?
I need a identity server for Node.js that works with relational databases
I am a relative newbie to node.js and typescript and am looking for tutorials and examples for building custom libraries for typescript. I am currently working on a project(switched to webstorm GUI) that requires I build several microservices and several of the microservices will need to share certain code, i.e., base repository functionality, etc. My though would be to move the code they have in common to a series of separate libraries(projects) and make them into typings and have the projects that need them to install them. Following the example I found here, and using grunt: What is the story for creating and consuming TypeScript libraries?, I was able to generate the .js file and the .d.ts files in a dist folder on the project. There are a few areas that I am confused about:

1) The example makes reference to a "main": "./dist/my.service.js" section in the jsconfig file, how necessary is this file and what should go into it?

2) If all of the files are transpiled and added to the dist folder, will the dependent code still be able to access it or do I have to transpile all of the files to root?

3) After I have have all of the file successfully transpiled and moved to the proper location, how do I install them to the dependent project if they are local and not up on the npm or Definitely Typed, etc.?
After upgrading to node.js 7.5.0, I encountered this error too:  Loading "grunt-karma.js" tasks...ERROR >> TypeError: Cannot read property 'prototype' of undefined
npm version
$ npm -v

node version
$ node -v

$ npm install -g xsl-transform
npm http GET
npm http 304
npm http GET
npm http GET
npm http 304
npm http 304

> node_xslt@0.1.9 preinstall C:\Users\TEMP.Rumba-DEV.010\AppData\Roaming\npm\node_modules\xsl-transform\node_modules\node_xslt
> node-gyp rebuild

C:\Users\TEMP.Rumba-DEV.010\AppData\Roaming\npm\node_modules\xsl-transform\node_modules\node_xslt>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
gypnpm ERR! node_xslt@0.1.9 preinstall: `node-gyp rebuild`
npm ERR! `cmd "/c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the node_xslt@0.1.9 preinstall script.
npm ERR! This is most likely a problem with the node_xslt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls node_xslt
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "xsl-transform"
npm ERR! …
I am trying to generate a pdf file from a dynamic handlebar webpage that would display data from the database. Once I get this to work on my local machine, I would like to move the code up to elastic beanstalk. The code seems to run that initially makes the call to spawn, however, call to phantomjs does not seem to kick off the script passed to it. Just to confirm, I added a console.log statement at the very beginning of the file and never the print out. Not to mention the other print statement in the script file. The code is below:

code that performs the spawn:
var childArgs = [
                  path.join(__dirname, '../phantom/capture.js'),

            let child = spawn(phantomjs.path, childArgs, {detached: false});

            console.log('set up stderr.....');
            child.stderr.on('data', (data) => {
              console.log('ps stderr: ${data}');

            console.log('set up stdout.....');
            child.stdout.on('data', (data) => {
              console.log('ps stdout: ${data}');

            console.log('set up close.....');
            child.on('close', (code) => {
                console.log('this is a test 2.....');
                if (code !== 0){
                    let error = new Error('An error occurred while creating the current report.');

Open in new window

Percona Live Europe 2017 | Sep 25 - 27, 2017
Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

upload.js file

module.exports.xml_node = "Abc";       

 $('.upload-btn').on('click', function (){

      $('.creatingXMLRequest').on('click', function (){

and accessing xml_node variable in app.js file

var upload_file = require('./public/javascripts/upload');        //console.log(upload_file.xml_node);

 After writing  .........module.exports.xml_node = "Abc";  ............... in upload.js file

getting this error..................................................................

$ node app.js
         $('.upload-btn').on('click', function (){
ReferenceError: $ is not defined
    at Object.<anonymous> (C:\Users\Desktop\file upload using node\public\javascripts\upload.js:8:3)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (C:\Users\Desktop\file upload using node\app.js:7:19)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)

how to resolve it???

var http = require('http');
var util = require('util');
var fs = require('fs');
http.createServer(function (req, res) {
    console.log('Request received: ');
    //util.log(util.inspect(req)) // this line helps you inspect the request so you can see whether the data is in the url (GET) or the req body (POST)
    //util.log('Request recieved: \nmethod: ' + req.method + '\nurl: ' + req.url) // this line logs just the method and url

    res.writeHead(200, { 'Content-Type': 'text/plain' });
    req.on('data', function (chunk) {
        console.log('GOT DATA!');

console.log('Server running on port 8080');


    <script language="javascript" type="text/javascript" src="jquery-1.8.3.min.js"></script>

    response here: <p id="lblResponse">fill me in</p>

<script type="text/javascript">
$(document).ready(function() {
        url: '',
        dataType: "json",
        data: {name:'abc',name1:'pqr'},
        type: 'POST',
            contentType: "application/json",
        jsonpCallback: 'callback', // this is not relevant to the POST anymore
        success: function (data) {
            var ret = jQuery.parseJSON(data);
            console.log('Success: ')
        error: function (xhr, status, error) {
I am reviewing several approaches to re-developing a node.js restful monolithic application using microservices combined with an api gateway. In looking at using the aws api gateway though there seems to be a few items I have not been able to find alot of documentation on. For one, the application I am designing has to be able to support SSO, I would like users to be able to register by either creating a local login or using their current facebook, twitter, etc. social accounts.

How would this process be handled by aws api gateway, especially since I would need to use a custom database to write to and read from, not to mention to authorizing the user?

Additionally, for example, say my microservices has the following bounded contexts:

account(login, registration, profile management),

billing(may not be ideal for serverless due to running time, may opt for docker + ec2),

friend(setting up friend associations),

file(users can upload pictures and videos to their timeline - seems to be another docker + ec2 candidate);

and I want to use an api gateway to secure all of the microservice endpoints except the ones specific to login and registration, how should this be done?

Node.js contains a package that seems to handle jwt and authentication users via facebook, twitter, local, etc. called passport, can I use this with the api gateway authentication?

Also, if the api gateway is securing the microservices, how does the request object and response object get …
I created an application on my local machine(mac os x) that generates a report and saves it to a folder in my web project folder. When I deploy the app., this folder should get published as well. Granted, no one should have access to this folder but the app. When I run the code to generate the report works fine on my local machine, but it seems to hang on elastic beanstalk. What do I need to do to make this work on the elastic beanstalk environment?

In a nutshell, I am using phantomjs to convert a dynamic webpage into a pdf file that gets emailed to the appropriate parties involved. Here is the code that generates the file:

page.viewportSize = { width: 2000, height: 800 };
//page.paperSize = { format: 'Letter', orientation: 'landscape', margin: '1cm' };
page.paperSize = { width: '1280px', height: '800px', margin: '0px' };
page.settings.localToRemoteUrlAccessEnabled = true;
page.settings.loadImages = true;
page.settings.javascriptEnabled = true;"" + args[1], function start(status) {
  if (status === 'fail'){

//page.render('/dev/stdout', { format: 'pdf' });
  page.render(fs.workingDirectory + '/tmp/' + args[3], { format: 'pdf' });

Open in new window


var fs = require('fs');
var addData = " <book category='children'><title>Harry Potter</title><author>J K. Rowling</author><year>2005</year><price>29.99</price></book>";
var cursor = "//cursor";
addData += cursor;
//var ws = fs.createWriteStream('./new_xml.xml');           //creating new file in same folder.      
fs.exists("new_xml.xml", function (exists) {
    if (exists) {
        //Adding new node in existing xml file      
        fs.readFile("new_xml.xml", "utf-8", function (err, data) {
            if (err) {
            var newData = data.replace(/\/\/cursor/, addData);
            fs.writeFile("new_xml.xml", newData, function (err) {
                if (err) {
                console.log("XML node is added successfully........");
            // console.log(data);      
    } else {
        console.log("File not exists.................");


   <book category="cooking">
       <title lang="en">Everyday Italian</title>
       <author>Giada De Laurentiis</author>
       <price>30.00</price> </book>

In this example before //cursor 1 book node is added after executing node js.....(using this command node add.js).

same code executed in …
I am new to aws and have to deploy a node.js app to their elastic beanstalk technology.  I reviewed their docs. and it look like I need to upload a zip(bundle) file to install the node.js app.  I am currently using eclipse neon for development and looking for a way, whether via script or ide, to automate the process of building the bundle file on the fly.  Ideally, eclipse would do this automatically for me whenever I would like to deploy.  I am looking for information and advice what I should use to automate the bundling and publishing processes.


Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world.