Node.js

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

jquery
node.js
css
javascript
html5

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


is there another w3schools.com so I can become a better beginner
not looking for 500+ characters code samples where i create entire websites
0
Moving data to the cloud? Find out if you’re ready
LVL 3
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 updated node and npm and now yo is not working. I installed it in many ways including sudo npm install -g yo.

It does install and runs the yo doctor. Everything checks out. But when I type yo doctor, it says

-bash: yo: command not found

Im wondering if it has to do with my path and node. I even tried to brew link node and have done many steps. Not sure what else to do so asking the experts!

Thank you all.
0
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 -
10.10.10.50

node 2
10.10.10.60

both nodes connected to DC server(10.10.10.10 = 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 …
0
Hello All,

I am reading a book called express.js Blueprints.  I am trying to wrap my mind around understanding authentication using passport.  serializing and deserializing is not registering to me.  I have just started learning node and express js so that's a big reason why.

Here's a code from the book on setting up passport.  Starting with line 5, can someone please break down what's happening?  Where is the "user" parameter coming from in the serializeUser function?  Where did "user.id" come from?

var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy;
var User = require('mongoose').model('User');

passport.serializeUser(function(user, done) {
done(null, user.id);
});
passport.deserializeUser(function(id, done) {
User.findById(id, done);
});

passport.use(new LocalStrategy(function(email, password, done) {
User.findOne({
email: email
}, function(err, user) {
if (err) return done(err);
if (!user) {
return authFail(done);
}
if (!user.validPassword(password)) {
return authFail(done);
}
return done(null, user);
});
}));

Open in new window

0
Hi Guys/Girls i'm having trouble with an exchange server, I am trying to upgrade to CU17.

Host is Server 2012R2

i have prepared AD via;

setup.exe /PrepareAD /IAcceptExchangeServerLicenseTerms
setup.exe /PrepareSchema /IAcceptExchangeServerLicenseTerms

then once running the setup for CU17 i get through all pre req checks etc, get too around 94% and the process hangs before Exchange will finally tell me upgrade has failed with this error;

Error occurreSystem.Exception: Failure configuring SearchFoundation through installconfig.ps1 - Error occurred while configuring Search Foundation for Exchange.System.TimeoutException: Timed out waiting for Admin node to be up and running

I have googled, until i can no longer google. Only references i see are firewall issues or permissions issue, none of which are a problem for me, firewall is off, and i am using full permissions.

I think the problem has something to do with my Exchange HostControllerService, It will start but stops immediately after, event viewer reports no problems in regards to it.

I Noticed OWA also will not search mail, So sure that these two problems are related, With search issues i normally expect database index state, but all is healthy.

im all out of things to try, was hoping for some advice. Cheers.
0
What will be the omnirpt command to get the list of all tapes used for the backup of a node?
0
Hi everyone,
                      my tsm 6.4  backup is failing with the message: ANS0326E This node has exceeded its maximum number of mount points.


any idea or steps to solve this issue?

Thanks in advance.

Santiago.
0
I havecreated a node.js express app using pdfkit to create dynamic PDFs.  I need to set the color as a Spot color, or at least 100% Black using CMYK for my workflow purposes.

The documentation for pdfkit shows only hex values as possible (#00000, #ff0000, etc...).  Does anyone know if it is possible to set a CMYK or Spot color?
0
-------my code-----

import xml.dom
import xml.dom.minidom
doc = xml.dom.minidom.parseString('''
<root>
   <person id="01">
      <name> abc</name>
      <age>32</age>
      <address>addr123</address>
      <siblings>
        <name></name>
        <name></name>
      </siblings>
   </person>
   <person id="02">
      <name> def</name>
      <age>44</age>
      <address>addr456</address>
      <siblings>
        <name></name>
        <name></name>
        <name></name>
      </siblings>
   </person>
</root>

''')


def innerHtml(root):
    text = ''
    nodes = [ root ]
    while not nodes==[]:
        node = nodes.pop()
        if node.nodeType==xml.dom.Node.TEXT_NODE:
            text += node.wholeText
        else:
            nodes.extend(node.childNodes)
    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
age=32
address=addr123
siblings=
                     
name= def
age=44
address=addr456
siblings=

---------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
0
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
0
Get MySQL database support online, now!
LVL 3
Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

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.
Server_State.PNG
0
Team, I need some help diagnosing this issue, asked by one of our DBA's, server is part of a cluster, the cluster was manually failed over to the other node around the time this issue/error occurred?
errorSQL.png
Message
Login failed for user 'XXX\WINXXXX$'. Reason: Token-based server access validation failed with an infrastructure error. Check for previous errors. [CLIENT: XX.XXX.XX.XX] - Any ideas where/how I diagnose what the issue is here?

Many thanks
0
I have this function 'loadSong' that I got from an example on the net. It works fine.

I now want to make 'songName' assigned the value retrieved from a QueryString, such as
localhost:3000?songName=Imagine

How can I do that please?

This is a Node.js application I have running on my local machine where I am testing. Eventually it will be on a Node hosting plan (Heroku).

Thanks!



function loadSong(songName) {
    resetAllBeforeLoadingANewSong();

    // This function builds the current
    // song and resets all states to default (zero muted and zero solo lists, all
    // volumes set to 1, start at 0 second, etc.)
    currentSong = new Song(songName, context);

// I NEED THE VARIABLE songName to be the value of a querystring. For example, from
// localhost:3000?songName=Imagine

// THE REST OF THE CODE IS INFO ONLY



    var xhr = new XMLHttpRequest();
    xhr.open('GET', currentSong.url, true);

    xhr.onload = function (e) {
        // get a JSON description of the song
        var song = JSON.parse(this.response);

        // resize canvas depending on number of samples
        resizeSampleCanvas(song.instruments.length);

        // for eah instrument/track in the song
        song.instruments.forEach(function (instrument, trackNumber) {
            // Let's add a new track to the current song for this instrument
            currentSong.addTrack(instrument);

            // Render HTMl
            var span = document.createElement('tr');
         

Open in new window

0
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.
http://www.ontaraj.com/test-wide-page/

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

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.
http://www.mydomain.com/index.html?songName="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.

Thanks.
0
Hi, please need guidance on how to fix the npm error. Thanks so much in advance.

# rpm --query centos-release
centos-release-6-6.el6.centos.12.2.x86_64

Open in new window


# node --version
v0.10.48

Open in new window


# npm --version

module.js:340
    throw err;
          ^
Error: Cannot find module 'npmlog'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at /usr/lib/node_modules/npm/bin/npm-cli.js:18:11
    at Object.<anonymous> (/usr/lib/node_modules/npm/bin/npm-cli.js:86:3)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)

Open in new window

0
Hello,

I am very new to nodejs but have been learning a lot these past few weeks.  I am trying to use passport to implement authentication but I am getting an error that I need to fix.  Any assistance would be much appreciated.  Here is the error I get..
node error
Below is part of my code:

index.js
const express = require('express');
const mongoose = require('mongoose');
const hbs = require('express-handlebars');
const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser')
const passport = require('passport')
const LocalStrategy = require('passport-local').Strategy
var User = require('./models/account')

mongoose.connect('mongodb:cluster0-shard-00-00-yng8g.mongodb.net:27017,cluster0-shard-00-01-yng8g.mongodb.net:27017,cluster0-shard-00-02-yng8g.mongodb.net:27017/vendorCollection?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin');


app.use(cookieParser())
//Persists data in memory inside of application
app.use(require('express-session')({
    secret: 'vendorSecret',
    resave: false,
    saveUninitialized: false
}))
app.use(passport.initialize())
app.use(passport.session())

//Allows you to use static files
app.use(express.static('public'))

app.use('/vendor', vendorRouter)
app.use('/admin', adminRouter)

passport.use( new LocalStrategy(User.authenticate()) )     //<---Error on this line
passport.serializeUser(User.serialize())
passport.deserializeUser(User.deserialize())

app.listen(3000, ()=>{
  console.log("Server Listening");
})

Open in new window

0
Hi, I got this Multitrack Player to work on Node.js on a Node hosting service heroku.com
https://github.com/squallooo/MT5
I also got it to work locally on my PC.

I have Wordpress hosting at Dreamhost.

Now I want to include the Multitrack Player into the Wordpress page.
I need some help with that.

For a start, how can I simply 'insert' the player into my WP page?

Thanks.
0
Hi experts,
aI'm trying to update nodejs version , i try this command lines :
f.png
I don't understand why  it can't be updated
PS: am using linux mint 17.2
0
Get proactive database performance tuning online
LVL 3
Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Hello Experts,

I have a webpage and I need to get the data from a postgres db.  I will probably hire someone to actually do this, but I'd like to understand the process prior.  I think that I have to use node.js to get the data from the database.  Does that sound right?  Or is there a better way to get at the data?
0
HI experts ,
I have to  update nodejs version. I checked several links but  noway .  
This  is  the last link i tried


But  i find the same nodejs version
f.pngps : am using linux mint 17.2

Thankx for help .
0
Hello I want to change my node location from "TOP" to "warehouse". Can someone please tell me the command?
0
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 …
0
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

HTTP METHOD

POST

GET

PUT

DELETE

CRUD OP

CREATE

READ

UPDATE

DELETE


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. …
0
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

Node.js

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.