Learn how to a build a cloud-first strategyRegister Now

x

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

Over the last few weeks I have been building and testing a two node S2D cluster I am just about finished with it but I have a question about CSV disk ownership when you run the VM fleet each node is assigned a CSV for the VMFleet storage if you reboot a node that nodes CSV moves ownership to the other node when the VM Fleet is run again the node with all the disk ownership runs at a higher load then other.  My question is two fold the CSV ownership does not move back when I unpause the node is this correct will I have to move the disk manually back to the correct owner every reboot? Second part is the assignment of the CSV previously I only had one due to the storage being provided by a 3rd server to the two nodes.  So If I want the best performance I should evenly split the storage and give each node a CSV and just put half of the VM's on one disk and the other half on the second CSV?
0
The Evil-ution of Network Security Threats
 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

Hello Everyone

I am a recently converted vb.net developer taking a Full Stack Web developer Boot Camp.  It is moving very fast and we are seeing quite a bit of information/technologies.  I am having a bit of trouble where they all fit together in the diagram.  

First we did HTML/CSS. Then added javascript.  Then moved the javascript to server side.  Then Node, Express, Sequelize. ORM, MVC, React/Yarn, Firebase, Mysql, Mongo.

Is there any kind of diagram that could help me understand how all of this relates together?

Thanks,
jimbo99999
0
guys, here is the question. I have one function that optimize images using jimp package and I want to run this function on the command line of one server on digitalocean but i dont want to install lots of things on it. so I install npm and node, but I am very new to node and npm, so I dont know how to execute this javascript that will read the files and optimize images. I want to be able to do something like this on terminal:   execute optimize.js /var/www/html


here is the function I did:

function optimize(path){
    let Jimp     = require("jimp");
    let fs = Npm.require( 'fs' ),
    try { var files = fs.readdirSync(path); }
    catch(e) { console.log(e); }
    if (files.length > 0){
      for (var i = 0; i < files.length; i++) {
          //console.log(files[i]);
          var originalPath = path + '/original/' + files[i];
          var currentPath  = path + '/' + files[i];
          //copy img code here
          console.log('Processing 1. Copying bkp to folder: '+originalPath);
          fs.copyFileSync(currentPath, originalPath);
          //remove current file code here
          console.log('Processing 2. Removing current file from folder: '+currentPath);
          fs.unlinkSync(currentPath);
          //optimize image.
          Jimp.read(originalPath, function (err, lenna) {
                  console.log('Processing 3. Starting Optimizing from: '+originalPath);
                  console.log('Processing 4. Starting Optimizing to:   …
0
Created a duplicate username entry in mongoose database and resulted in duplicated error. Now everytime I start server, I get this error:

(node:14839) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CastError: Cast to ObjectId failed for value "{ type: 'Buffer',
  data: [ 89, 243, 30, 231, 66, 69, 45, 56, 123, 65, 153, 72 ] }" at path "_id" for model "users"
(node:14839) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
0
Python Gurus,

I have an outer loop where I pull node information off the network, within that loop I pull the device information, within that loop, I pull the connected device info. Mostly I cycle through this loop without errors, however, lately I've been getting the error "string indices must be integers". The failure is happening in the last inner loop (clients). Since this just started happening, I'll have to assume new data came through that I haven't accommodated.  I would like to write this in such a way that I accomplish 2 things: 1.) Identify which element is the culprit; 2.) when there's an error, it is noted (logged), then on to the next, without an exit.

       
  
       try:

            [snippet begin]
         
             clients_json = clients_response.json()
  
              for clientEntry in clients_json:
                    mdnsName = clientEntry['mdnsName']
                    deviceDesc = clientEntry['description']
                    dhcpHostName = clientEntry['dhcpHostname']
                    clientMac          = clientEntry['mac']
                    Id          = clientEntry['id']
                    Ip          = clientEntry['ip']
                    usageRecv     = clientEntry['usage']['recv']
                    usageSent         = clientEntry['usage']['sent']
                    #TODO: Get this is UTC format
                    InsertDate = '10/24/2017' 

      
                pass

               [snippet ends]

        except 

Open in new window

0
I am building an node.js based application using the microservices pattern.  I have the individual microservices developer including one that handling registering, authenticating and authorizing users.  I am now ready to add an api gateway and am reviewing Kong along with a few others.  Right now, Kong seems to be the most robust except there are a few items that I need clarity on.  

1) Since I already have a user microservice responsible for user management functionality, how can I make Kong aware to use it to authenticate the user and get the subsequent payload from it to use for building the jwt token?

2) Also, I have several endpoint on my microservices that provide additional get and post functionality, etc. like /lists for returning a json list of items as opposed to get which just return one specific json object.  Do I need to do any additional configuration of Kong to allow for this scenario?
0
I have a bunch of complicated node apis deployed on ec2s. What would be the easiest way to make them lambda compliant (by adding handler method) and deploy them on lambda ?
I am looking for some steps and guidance.
Thanks
0
Im a Delphi programmer with som old HTML experience. I want to go JS node and Typescript. Where should i start? What do i need to know before i start with JS node and Typescript or is it just to go?
0
Hi guys,

On our side we have a SAML2.0 SP implementation using simplesamlphp. Which works for dozens of customers. Including 5 ADFS customers.

But now we have one of the new integrations when things does not work. And it seems AD FS is not sending us required attributes. Customer claims that they as well have dozens of integrations and all of them work.

Their ADFS version is 3.0

Differences that we see between other responses (from successfull integrations with ADFS) and their response:
 
1.      There is no <status> xml node
<samlp:Status>
<samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
</samlp:Status
<Assertion xmlns="urn:oasis:names:tc:SAML:2.0:assertion" ID="_36da30d0-467d-4eec-8dbd-f9da25545c61" IssueInstant="2017-08-09T12:42:00.977Z" Version="2.0">
2.      No Assertion node: <Assertion xmlns="urn:oasis:names:tc:SAML:2.0:assertion" ID="_36da30d0-467d-4eec-8dbd-f9da25545c61" IssueInstant="2017-08-09T12:42:00.977Z" Version="2.0">
3.      No “<Subject>” node. The response ends with “<Signature>” xml node. And in other successfull implementations there is a “<Subject>” node which includes all the attributes (like uid, email and etc).

What could that be? They say, all claims are setup from their side.
0
Hi, I am using bootstrap treeview , I would like to know how I can add node dynamically at run time. means users should able to add any node.

any help will be highly appreciated.

Regards,

Aamir
addNodes.png
0
Put Machine Learning to Work--Protect Your Clients
Put Machine Learning to Work--Protect Your Clients

Machine learning means Smarter Cybersecurity™ Solutions.
As technology continues to advance, managing and analyzing massive data sets just can’t be accomplished by humans alone. It requires huge amounts of memory and storage, as well as the high-speed power of the cloud.

I am working with paypal payment. I want to implement payment condition below:-

Block payment amount on card at the time of reservation. If card cannot be blocked reject the event and add "Payment Declined" to the end of the description. Take payment at 12:01 am the day of the event.

For recurring events...
Block payment for first event at time of reservation. Take payment 12:01 am the day of the event.
For next event in the recurrence series, Block payment after the previous payment is taken and take payment at 12:01 am the day of the event. Continue this cycle until all reservations are complete.
 If card cannot be blocked reject the event and add "Payment Declined" to the end of the description but continue with the series of events.

Please know me how to implement.
0
Hi everyone i really need to know why i cant get to my EVO-rail manager for my vxrail. I have all my 4 nodes up and communicating i just cant get to the vxrail manager. Please help me.. the picture below show the 1st node which is shows that i have no vms.. what do i do? M i missing something ?
0
When I hit ng serve on cmd it's not working although its working 1st & 2nd time but its not working now. All things are running perfectly. eg ng --version .. the problem is only with ng serve ..it only runs for the 1st & 2nd time..

Here is the error that cmd geneartes.

 $ ng serve
    ENOENT: no such file or directory, stat 'E:\Work\Angular\Basic website\Angular 4\my-first-app\src\tsconfig.json'
    Error: ENOENT: no such file or directory, stat 'E:\Work\Angular\Basic website\Angular 4\my-first-app\src\tsconfig.json'
        at Error (native)
        at Object.fs.statSync (fs.js:1000:11)
        at AotPlugin._setupOptions (E:\Work\Angular\Basic website\Angular 4\my-first-app\node_modules\@ngtools\webpack\src\plugin.js:62:16)
        at new AotPlugin (E:\Work\Angular\Basic website\Angular 4\my-first-app\node_modules\@ngtools\webpack\src\plugin.js:27:14)
        at _createAotPlugin (E:\Work\Angular\Basic website\Angular 4\my-first-app\node_modules\@angular\cli\models\webpack-configs\typescript.js:55:12)
        at Object.exports.getNonAotConfig (E:\Work\Angular\Basic website\Angular 4\my-first-app\node_modules\@angular\cli\models\webpack-configs\typescript.js:71:19)
        at NgCliWebpackConfig.buildConfig (E:\Work\Angular\Basic website\Angular 4\my-first-app\node_modules\@angular\cli\models\webpack-config.js:29:37)
        at Class.run (E:\Work\Angular\Basic website\Angular 4\my-first-app\node_modules\@angular\cli\tasks\serve.js:43:98)
        at 

Open in new window

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
What will be the omnirpt command to get the list of all tapes used for the backup of a node?
0
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
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
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
Fill in the form and get your FREE NFR key NOW!
LVL 1
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

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

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.

Top Experts In
Node.js
<
Monthly
>