Node.js

23

Solutions

70

Contributors

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 successfully got this example to work on my Windows 10 pc. (thanks to help from Expert it_saige)
https://www.experts-exchange.com/questions/29039118/Running-a-Hello-World-on-Node-js-on-Windows-10-newbie.html?anchor=a42185760¬ificationFollowed=191140277#a42185760

I now want to host it on a GoDaddy hosting account I just signed up for.

I've never setup a Node.js website before - though I have worked with IIS/ASP sites for years.
Is it just a matter of copying the files to a particular folder (eg. root)?

Thanks for any help.
0
What is SQL Server and how does it work?
LVL 1
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

I'm trying to run this example here https://github.com/squallooo/MT5 (of an HTML5 application)

It needs to run on Node.js - I am unfimilar with Node.js. (though ok with IIS)

I have downloaded Node.js and installed it. I have downloaded the ZIP file from GitHub.

Can someone please give me a step-by-step to enable me to open/run this one-page web file?

A demo is here http://mainline.i3s.unice.fr/
(pretty cool if you're a musician)

Thanks
0
I am trying to connect to MongoDB in mongoDBatlas from my javascript but I keep getting the following error.

MongoError: connection 5 to isaaccluster-shard-00-02-yng8g.mongodb.net:27017 closed
    at Function.MongoError.create (C:\Users\558642\ga\js-dc-5\11-crud-and-dbs\assignment\todo\node_modules\mongodb-core\lib\error.js:29:11)
    at TLSSocket.<anonymous> (C:\Users\558642\ga\js-dc-5\11-crud-and-dbs\assignment\todo\node_modules\mongodb-core\lib\connection\connection.js:202:22)
    at Object.onceWrapper (events.js:293:19)
    at emitOne (events.js:101:20)
    at TLSSocket.emit (events.js:191:7)
    at _handle.close (net.js:511:12)
    at Socket.done (_tls_wrap.js:332:7)
    at Object.onceWrapper (events.js:293:19)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:191:7)
    at TCP._handle.close [as _onclose] (net.js:511:12)


Here's my code
const express = require('express')
const hbs = require('express-handlebars')
const mongoose = require('mongoose')
const bodyParser = require('body-parser')

mongoose.connect('mongodb://XXXXXXXXXXXX@isaaccluster-shard-00-00-yng8g.mongodb.net:27017,isaaccluster-shard-00-01-yng8g.mongodb.net:27017,isaaccluster-shard-00-02-yng8g.mongodb.net:27017/<DATABASE>?ssl=true&replicaSet=IsaacCluster-shard-0&authSource=admin')

const itemEntry = require('./models/toDoEntry.js')
const app = express()

app.get('/', function( req, res ) {
	itemEntry.find({}, function( err, itemEntries ) {
			res.render('todoList',

Open in new window

0
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?
0
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?
0
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 …
0
Hi,
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('turn:my.domain.com:443?transport=tcp', '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

listening-port=80
tls-listening-port=443
listening-ip=10.10.10.10
relay-ip=1.1.1.1
external-ip=1.1.1.1/10.10.10.10
lt-cred-mech
user=user:pass
realm=domain.com
no-udp
no-dtls
no-udp-relay
cert=/usr/local/etc/cert.pem
pkey=/usr/local/etc/pkey.pem

All is running in AWS cloud.

0
Which Database Choose?

This Article about choose the NOSQL database based on application requirement. Different NoSQL DB’s available, there are three primary concerns you must balance when choosing a data management system: consistency, availability, and partition tolerance.

 

* Consistency means that each client always has the same view of the data. * Availability means that all clients can always read and write.

* Partition tolerance means that the system works well across physical network partitions.

 

Chose the Database system based on your application requirement.

 Example Comparing MongoDB and CouchDB.

As you can see in the diagram, MongoDB and CouchDB are built with a slightly different focus. Both scale across multiple nodes easily, but MongoDB favours consistency while CouchDB favours availability.

In the MongoDB replication model, a group of database nodes host the same data set and are defined as a Replica set. One of the nodes in the set will act as primary and the others will be secondary nodes. The primary node is used for all write operations, and by default all read operations as well. This means that replica sets provide strict consistency. Replication is used to provide redundancy - to recover from hardware failure or service interruptions.

CouchDB uses a replication model called Eventual consistency. In this system, clients can write data to one node of the database without waiting for other nodes to come into agreement. The …
0
Hi

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?

Thanks
0
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...
internal/child_process.js:289
  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

0
Office 365 Training for Admins - 7 Day Trial
LVL 2
Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

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!
0
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?
Capture.PNG
Capture1.PNG
0
Hello experts,

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

Thank you
0
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?
0
I have node installed on my laptop.

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

C:\programfiles\angularjs

node is installed here:

C:\programfiles\nodejs

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:

localhost:5000/test.html

But the test.html file resides at this location:

C:\programfiles\angularjs\test.html

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

and

npm install serve-static -g

and then ran "node server.js"

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
0
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:

memsqlPool.execute.onFirstCall().returns('some-value');
memsqlPool.execute.onSecondCall().return('some-other-value');

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

Anyone can help?
0
I need a identity server for Node.js that works with relational databases
0
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) {
                finishLoad();
            }
        }
    }
    ajax.open("GET", randomizeUrl(url), true);
    ajax.send(null);
}

Open in new window

1
A simple login application using Node JS, Mongo DB and Express frameworks. There are tons of tutorials on Node JS and Express but most of the use extensive plugins which would confuse the beginners, the primary motive of this article is to ensure it captures the bare minimal functionality.
0
2017 Webroot Threat Report
2017 Webroot Threat Report

MSPs: Get the facts you need to protect your clients.
The 2017 Webroot Threat Report provides a uniquely insightful global view into the analysis and discoveries made by the Webroot® Threat Intelligence Platform to provide insights on key trends and risks as seen by our users.

best way to have users and roles and authenicate based on these users and  roles  and based in nodejs apis?
0
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.?
0
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
0
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.

CsvJPG.JPG
0
npm version
$ npm -v
1.2.14

node version
$ node -v
v0.10.0


$ npm install -g xsl-transform
npm http GET https://registry.npmjs.org/xsl-transform
npm http 304 https://registry.npmjs.org/xsl-transform
npm http GET https://registry.npmjs.org/node_xslt
npm http GET https://registry.npmjs.org/mkdirp/0.3.5
npm http 304 https://registry.npmjs.org/node_xslt
npm http 304 https://registry.npmjs.org/mkdirp/0.3.5

> 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! …
0
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 = [
                  //'--debug=true',
                  path.join(__dirname, '../phantom/capture.js'),
                  id,
                  filename
                ];

            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.....');
                console.log(code);
                if (code !== 0){
                    let error = new Error('An error occurred while creating the current report.');
                    

Open in new window

0

Node.js

23

Solutions

70

Contributors

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
Node.js
<
Monthly
>