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

I am looking into Webpack 2 Code Splitting for a project but I'm not sure if I understand how code splitting works.

In my project I have 2 features.

Each feature consists of 4 or 5 files so the code for each feature has several javascript files where the code lives.

These javascript files are NOT ES6 Modules, just standard javascript files with code.

With Webpack 2 Code Splitting I intend to break all these files into 2 groups so that can load them on demand when needed.

So, what I'm thinking of doing with it is ...

1. Project Loads just the core

2. On demand the features will load when needed.

Would code splitting work in this circumstance and is this what it's for?
I am working on a project using, node, Webpack, babel and ES6.

Inside my project I've created a module which I want to load into the project at runtime.

The end result I'm looking for is that when the application will have different features. The code for each feature will be in a module.

The user can then enable or disable certain features at runtime.

How can I do this?
As a junior, I'm a bit new to front end programming (crammed learning JS/other languages/NPM/NodeJS/etc within three months for my current role) so apologies if what I say doesn't make sense.

I've helped to build a UI for an application with the use of NPM/Node JS. The application stores data on a UNIX server. The UI accesses the data on the server (https://myhostname:8090/blah/blah) and presents the results with a nice UI. With the help of GIT, I've managed to do move all the src UI code onto the UNIX server. The purpose is for automation

While a specific file (in my UI code) specifies the UNIX server configuration, I've used NPM to build a bundle.js (Which bundles all the JS files into a single file) file. I move this bundles.js along with the index.html and CSS styling files to an appropriate directory in order to use Maven to build a JAR file. And with a start/stop server script to run the process to run  the code, I can just enter the UNIX hostname/port number in my browser window in order to access the UI and data. This all works.

However. I now need to generalise the server configuration in my bundle.js file as well as properties file on server side such that I'm not hard coding server configuration anywhere (meaning I can deploy the UI on any server with no issue). i.e. playing with "localhost" instead of the actual server hostname etc.

I want to try my best, but I need to acknowledge that I have no real server configuration experience and hence need a …

In Facebook, 1000's of people can like or frown or comment on certain columns.

In the Facebook API, am I able to easily message those people interested in the topic? are there ways, Apps to do this? Any costs?

This message page suggests billions? Really . . . .? . . .  here

Do I need to use Java or PHP coding in any way?

Hello Exchange Experts,

I have 1 DAG with 4 nodes with Exchange 2013, I would like to know if I could create 1 BD for my heath mailbox, I have read that is not a best practice to move them, but for my administration could be better. So my questions:
*  The health mailbox has to be local in each node? or I could have them all in one server
* Could I move the health mailbox to another DB, and another disk unit, in the same node?

Thanks a lot!
Hi All,

I have a 2 node hyper v cluster running a bunch of virtual machines.

I can successfully connect to the cluster via failover cluster manager with no issues. I have run the validate cluster tool which passes successfully also

When I right click on a node and select 'connect' I get the console window as expected, however it only works on hyper v host 1 not hyper v host 2.

When I also try and connect to the problem host via Hyper-V manager I receive the following:

Any suggestions?
Hello experts,

Is there any way to handle cuss words in
 Nodejs application.

Thank you
I have node installed on my laptop.

I have a folder that I want to use for my testing of angular:


node is installed here:


From within the nodejs directory I want to be able to start an http server like this:

C:\programfiles\nodejs> node server.js

which would start the http server and just wait, listening on some port like 5000

then, in a web browser like Chrome, I want to navigate to localhost and load an HTML file:


But the test.html file resides at this location:


I've been doing lots of reading on "express" and "connect" middleware, but I just can't seem to make it work.

For example:

I ran the following:

npm install connect -g


npm install serve-static -g

and then ran "node server.js"


var connect = require('connect');

var serveStatic = require('serve-static');

connect.createServer( serveStatic("../angularjs") ).listen( 5000);

Open in new window

gives this error:

TypeError: connect.createServer is not a function
Below is my  code,Can   anyone please  tell me why my window.onload function  does not  work? I am javascript newbie

// performs an AJAX get call asynchronously and puts the result into an element
function ajaxAsync(url, elementId) {
    var ajax = createAjaxRequestObj();
    ajax.onreadystatechange = function() {
        if (ajax.readyState == 4) {

//Here is my window.onload function
            window.onload = function(){
                document.getElementById(elementId).innerHTML = ajax.status == 200 || ajax.status == 304 ? ajax.responseText : "(an error has occurred - please try refreshing the page - " + ajax.status + ")";
            if (finishLoad) {
    }"GET", randomizeUrl(url), true);

Open in new window

best way to have users and roles and authenicate based on these users and  roles  and based in nodejs apis?
Hi Team,

I have a 2 node hyper V cluster running on windows server 2012 R2 ,i wanted to convert present LUN to CSV but i am not getting the option.

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! …
Hello expert,

 I have a piece of code which i used it in other, is it a correct way of doing it or any other way we can have

function addZero(i) {
	if (i < 10) {
		i = "0" + i;
	return i.toString();

Open in new window

//---  create current date in YYYY-MM-DD HH:MM:SS format ---//
function curDate() {
	var d = new Date();
	var crDate = d.getFullYear()
	+ '-' + addZero(d.getMonth() + 1)
	+ '-' + addZero(d.getDate())
	+ ' ' + addZero(d.getHours())
	+ ':' + addZero(d.getMinutes())
	+ ':' + addZero(d.getSeconds());
	return crDate;

Open in new window

Hello expert,

Any tools to analysis the code  like coding standards on angularjs and nodejs side

Thank you


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 …
Hi guys,

I am trying to figure out the best way to automatically pull down certain files from a server i was thinking a cron job would be the best way, i was wondering is there anything wrong with my script here and would there be a better way to do it?

The files are json files, and they are playlists on machines that could be currently in use

Something like
if(playlist.json file == error message){
//download json file again

It will also need to check which playlist is currently playing (before toggling each playlist using the script) and ensure it is set back to that same playlist after toggling each


Something like
var count = 0;
if(playlist.json file == error message && count<3){
//download json file again
count ++;
//load playlist into threadqueue
//must be issues downloading the playlist so revert to default playlist and flag us
Can anyone please  help? I  am trying to extract  an ID 254162  from  URL  http://localhost:9080/company_add.jsp?id=254162. I have  tried  to  write  as seen  below but I  when I  do  console.log,Java script  return /company_add.jsp only.Anything I am missing?.Thank you
var url=window.location.pathname;
            var  UrId=url.substring(url.lastIndexOf('=') + 1);

Open in new window

I am trying to login a user using an api request which passes the jwt token in the querystring, followed by a location.href call to redirect the user to a protected url(html page). On the server side for my jwt setup method I am setting up jwt with the following code:

app.use(expressJwt({secret: process.env.AUTH_KEY,
  credentialsRequired: true,
  getToken: function fromHeaderOrQuerystring (req) {
    if (req.headers.authorization && req.headers.authorization.split(' ')[0] === 'Bearer') {
        return req.headers.authorization.split(' ')[1];
    } else if (req.query && req.query.access_token) {
      console.log('the access token = ' + req.query.access_token);
      return req.query.access_token;
    return null;
  }}).unless({path: [{ url: '/api/forgotpassword/', methods: ['PUT'] }, 
  { url: '/forgotpassword/', methods: ['GET'] }, 
  { url: '/api/login', methods: ['POST', 'PUT'] },
  { url: '/login', methods: ['GET'] },
  { url: '/index', methods: ['GET'] },
  { url: /\/css\/*/, methods: ['GET'] },
  { url: /\/js\/*/, methods: ['GET'] },
  { url: /\/images\/*/, methods: ['GET'] },
  { url: '/resetpassword', methods: ['GET'] },
  { url: '/api/resetpassword', methods: ['PUT'] }]} ));

Open in new window

Even though I can see the code gets executed for the getToken method, tied to the expressJwt object, and the return gets executed to return the access_token, I am still receiving the error indicating "No authorization token was found". Is there any additional plumbing required to integrate express-jwt and passport? Just to show the location.href is passing the url successfully, here is one of the url's: http://localhost:3000/testlist/1?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZmlyc3RuYW1lIjoiS2V2aW4iLCJsYXN0bmFtZSI6IlRheWxvciIsInJvbGVzIjoiYWRtaW4iLCJpYXQiOjE0ODg3NTM2OTIsImV4cCI6MTQ4OTM1ODQ5Mn0.4_XUXPAU13LtGRXqADuQpW0-jW2wErNlftjo4mttH7U, Plus I am seeing it in the getToken call. This is incredibly confusing. What could I be missing here? I follow this example to code the authentication, Any help would be greatly appreciated.
I'm looking for information on node.js. I am planning to implement an e-learning solution for a school system, and a partner suggested we use node.js as a platform, but since moodle is in php, and node.js is javascript, I'm confused. I have also never used this before, and don't understand what it is for.
can somebody help us lighting on sessions on client side on angularjs2 side. For Authentication we use passport     authentication node js. is it required to handle session  from the client side.. Let us know if any questions...
Hi ,
I have written a code for mongoDb Update.
                var _data = responses.devices;
                var existingUser = {
                    'ipackages': _data.ipackages

      , function(err, result) {
                    if (err) {
                        console.log("Error : " + err)
                    console.log("## USE UPDATED Successfully ## ");
                        /* REDIS CACHE */
                        redisClient.hmset(key.toString(), newUser, function(err, reply) {
                                console.log('Error : '+err)
                                //throw err;
                                console.log('Data : '+reply)

                    res.send({'message':'User Updated Successfully'})

Open in new window

But after compilation i am getting this error.

TypeError: is not a function
    at D:\Ad\AdServer\routes\users.js:112:23
    at Query.<anonymous> (D:\Ad\AdServer\node_modules\mongoose\lib\model.js:3398:16)
    at D:\Ad\AdServer\node_modules\kareem\index.js:259:21
    at D:\Ad\AdServer\node_modules\kareem\index.js:127:16

Open in new window

Please help me out.
Hello ,
  I have a JS function  that I used to send notification. However, I am getting some time out from database . I would like to queue the request .

Then have some process that iterate thru the  queue and send the notification.  The queue is always getting updated with new request

the 'pushService.sendNotifications' call is just another function that format the message and send

Can you give me some suggestion on how to implement it,,,

function sendNotifications(req, res) {
  pushService.sendNotifications(req.headers.apikey, req.body)
  .done(function (results) {
    log.debug('notification results: ' + JSON.stringify(results, null, 2));
  }, function (error) {
    log.debug('push failed outright: ' + JSON.stringify(error, null, 2));

Open in new window

I am familiar with JavaScript and JQuery. However I need to run some code for an application called OneFlow which is used for submitting order details. The script is in GitHub here:

I wish to run submit-order.js. However it uses the command "require" at the top which I understand is part of NodejS.

Can someone please explain the simplest way to run this script and import NodejS? WIth JQuery it is simply a matter of referencing the latest JQuery file. Can I do something similar for NodejS?

Incidentally I need to run this on a Windows 2008 server.
We are designing a web app build with JavaScript, NodeJS, Express, React/Redux, Bootstrap.

We have many pages where a user clicks on a link in a table or presses a button to download a file. The team that has done most of the work on the app triggers the download in a few steps in order to make sure the file being downloaded actually exists, otherwise an error is displayed. They use a popup browser window to deliver the file to browser user. For some reason, the popup is being suppressed by Safari and blocked by Chrome.

Can you look at the code and pinpoint why the popup is being blocked or perhaps point me to a tutorial on how to trigger a file download without using popups at all?

Our table:
			<BootstrapTable condensed={true} bordered={false}
				options={{ sizePerPageList: [10, 15, 20, 25, 30, 50, 100, 250, 500] }}
				data={uploadedFiles} striped={true} hover={true}
				pagination={true} search={true} searchPlaceholder='Filter'>
				<TableHeaderColumn dataField='fileName'	dataAlign='left' dataSort={true}
					width='50' dataFormat={this.downloadFileLink.bind(this)}>FileName</TableHeaderColumn>

Open in new window

Methods called when cell is clicked. rGet is a custom helper. All it does is send a Get request to our API (written in ExpressJS) to request the  file. One thing that I find interesting is that the coding team builds a link that the popup will use. I am guessing they do it to tell the browser that the popup belongs to our website and not a 3rd party site. I am correct? If so, why is this strategy not working and the popup is blocked by both Chrome and Safari?

Open in new window

We have build a simple dropbox-like web application using JavaScript/NodeJS/Express. It talks to our API routes, also written in JS. The UI is based on Bootstrap + commercial UI template. We used React/Redux architecture for web front end.

We have a button that uploads a file the user has selected, by calling our our API. We noticed that often our API returns status 200 or status  201 for successful requests. Is there a reason the status is randomly 200 or 201?

We used to check for success by checking for:
if (res.status === 200)

What is the best practice? Is there a clever way to check for all types of success status? Or should we always hard code:
if (res.status === 200 || res.status === 201)
Is there a way to avoid code duplication?






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.

Top Experts In