Most voted "node.js" questions
Node.js (or commonly Node) is a Javascript Runtime created with Chrome’s Javascript V8 engine. It allows you to run Javascript code without the need for a browser, raising the privileges to those found in other desktop languages. It is a technology strongly focused on non-blocking programming of I/O operations, which makes it very efficient for these operations.
Learn more…2,679 questions
Sort by count of
-
34
votes1
answer36730
viewsJavascript: Differences between import and require
I know that import and require are used in Javascript to import functions or objects from third parties. Code snippets like: import Library from 'some-library'; or const Library =…
-
25
votes2
answers4446
viewsHow to package a Node.js project into an executable?
I have a Node.js project but I need to create an executable for Windows and one for Linux, both of which still contain the built-in Node.js. I managed to do something similar in an app node-webkit…
-
23
votes3
answers2439
viewsWhat is the real advantage of using a Callback and what is thread/multithread?
There is a lot of explanation of what callback is on the net and even a few scant examples, but nothing that explains in practice and in detail a really important use (I did not find). I already…
-
23
votes2
answers8678
viewsWhat is NPM and Node?
The title of the question says it all. There are many articles about it, but in a clear and beginner way, what is NPM and what does it do? Like Node? What they contribute to the construction of…
-
19
votes1
answer15921
viewsWhen to use module.Exports or Exports on Node.js?
I am starting my study with Node and I came across the two ways to export something so that it is available with the require, I would like to know what is the best way and why. Thank you…
-
19
votes1
answer294
viewsError running container (Docker) with browser-Sync
I get this warning when I give start in my container with browser-Sync: [BS] Watching files... (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Exited…
-
15
votes3
answers2138
viewsHow to perform unit tests on nodejs
I’d like to run unit tests on Node.js, I’m using the grunt-jasmine, but it does not recognize the variable exports, module and neither required. Is there a way to solve this or does someone suggest…
-
15
votes1
answer3815
viewsWhat are the ideal use scenarios for Node.js?
The theme is broad, but I’ll try to focus on what I really need to understand. Lately I’ve been studying Node.js, and I’ve been surprised by the tool, in the comparative that I’ve seen, seems to be…
-
14
votes3
answers3827
viewsHow to publish applications done in Node.js
Well, I’m new with Node.js, I was able to build an example application, I learned a lot from Node with Express, but I can’t understand how to publish the application on the linux server. Does anyone…
-
14
votes4
answers1700
viewsUnderstanding Node and Applications in Real-Time
Since I met the Cakephp I got used to programming with him, because I had a small learning curve and very fast development. For my recent application, I needed the data entered by users to be…
-
14
votes2
answers5459
viewsWhat are middleware in Nodejs?
What are middleware and how important it is for the Node platform?
-
14
votes1
answer2315
viewsReal time with PHP
I am developing a system and soon I will have to start the real-time interaction part (for notifications and chat). I am using jQuery, PHP and MySQL so far and I intend to continue with these…
-
14
votes1
answer8164
viewsNPM --save doubt
What difference when installing a module via NPM, use --save? When using npm install product name, it installs the same and save the modules to the project folder. I didn’t understand then when to…
-
13
votes1
answer546
viewsFilter locations in an area of X km
I am trying to set up a small project where I have a list of locations and can filter them according to a x km amount. Ex: Filter all places within a 5km radius of my current location. I have a Json…
-
12
votes1
answer3675
viewsWhat is the difference between "dependencies" and "devDependencies"?
What’s the difference between saving a component like "dependencies" or "devDependencies" in the Bower, npm, commiserate among others using this structure ?…
-
11
votes3
answers8084
viewsCORS on Nodejs without the use of Frameworks
I am creating an app in Phonegap and consumes an API provided through Nodejs. For that to happen, I need Nodejs to accept the CORS. How do I enable the CORS for Nodejs to accept the request?…
-
11
votes2
answers2109
viewsHow to advertise server IP on the network?
I am developing an application composed of a server NodeJS which shall provide data in JSON for customers, in case an application for Android, all running on internal network. I have already managed…
-
11
votes1
answer4239
viewsWhat are the differences between Promise.all() and Promise.allSettled()?
I’m running some tests with Promises and I found that there are two ways to get the result of a set of protocols: using Promise.all(): async searchSegmentsInformations(segmentId) { try { const…
-
10
votes3
answers9800
viewsHow to keep a server nodejs running permanently?
I want to know how to maintain my server nodejs permanently running on my vps Ubuntu I bought without the need to run Putty and run the command node app.js. I made a REST API that will be consumed…
-
10
votes3
answers20032
viewsError trying to install modules in Nodejs: "Error: Can’t find Python Executable "python", you can set the PYT HON env variable."
When I try to install the modules I need it returns me several errors at the time of installation (in this case I tried to install the socket.io): Microsoft Windows [versão 6.3.9600] (c) 2013…
-
10
votes1
answer361
viewsPassport Session authentication on Android
I have a web app running with Nodejs, Express and Passport-JS authentication, and everything works perfectly. Now I’m developing an Android app and need to authenticate my users using the same API.…
-
10
votes1
answer7242
viewsDifference between Promise.then( sucess, error ) and Promise.then() . catch()?
Hello, I would like to clarify the difference and when to use each of the models of handling promises: obj.promessa( parametro ).then( function ( resposta ) { console.log("Resposta: " + resposta);…
-
10
votes3
answers1210
viewsHow to organize a project in Ode
I would like some idea of how I could organize a project in Node.js, currently the files are this way: - router.js - controller L controllerUser.js L controllerAuth.js L ... - service L…
-
10
votes2
answers573
viewsGlobal variable returns Undefined when using this in Node.js
I’m studying about the special variable this and I came across the following situation: When executing the function below in Node.js (version 12.18.3) the result is undefined and only returns 2 if I…
-
9
votes1
answer241
viewsWhat are the implementation differences between the Browser.log console and Node.js?
Yesterday I was using a Mootools class on Node.js and I came across strange behavior on console.log node.js. The code works great, but the console doesn’t show what I know is there. For example…
-
9
votes1
answer921
viewsDesktop development with Electron
With the growth of web many people have abandoned desktop development, but some interesting technologies have emerged, such as the Electron: Electron allows you to create desktop applications with…
-
9
votes2
answers15933
views -
9
votes5
answers4393
viewsTransforming a JSON information into a variable
I am calling a function in Node.js and it returns a JSON: { "pair": "BTCBRL", "last": 2280.0, "high": 2306.0, "low": 2205.0, "vol": 113.17267938, "vol_brl": 255658.20705113, "buy": 2263.0, "sell":…
-
9
votes1
answer1639
viewsWhat is Access Token? What is it for?
What exactly is an Access Token? What is an Access Token for in an API application? I would like an answer addressed to Node.js, but I believe that API creation exists in several languages, so I do…
-
9
votes2
answers18748
viewsconvert json to javascript array
How do I convert the following json in array: { '0': '{ "codBanco":"085","banco":"cecred","cedente":"Aluno…
-
9
votes1
answer197
viewsDeno and Node.js - Compatibility
The creator of Node.js has developed a new Javascript platform called Deno. The code written for Node.js will be compatible with this new platform? There is a Issue open about it, but I didn’t quite…
-
8
votes2
answers969
viewsHTML Desktop app with Node.JS + Socket.IO
I need to develop an HTML-based chat app that connects to a Node.JS server that is running with Socket.IO. I even developed much of the app using Tidesdk, but at the time of the integration to call…
-
8
votes5
answers51063
viewsCommand "npm" is not recognized by Command Prompt
I have a project with a package.json, in it I have everything configured. I just cloned that same project on another machine, man git clone worked smoothly. But when I give the command npm install…
-
8
votes1
answer2562
viewsMain differences between Mongodb and Redis
I’m reading a book on real time applications with Nodejs. The author used Mongodb and Redis to exemplify the use of database with Nodejs. My doubt arose when he used both at the same time,…
-
8
votes1
answer501
viewsWhy Nodejs has versions 4.x, 5.x, 6.x and 0.1x.x, etc
Why Node.js exists in versions 4, 5 and 6, but also exists in versions 0.x.x. Or perhaps, what are the differences between the versions x.x and 0.x.x?
-
8
votes2
answers6076
viewsHow do I set up Visual Studio Code to open the console in a new window?
In previous versions of the Visual Studio Code was opened in a window outside the Visual Studio Code, but in the new versions this screen of Console started to be opened inside the Visual Studio…
-
8
votes2
answers115
viewsHow to know which parole is giving true?
For example, I have the following if: if(!condicao1 || !condicao2 || !condicao3){ retorno erro com a condiçao que nao existe } When he gets into that if i wonder which of the parameters is missing…
-
8
votes2
answers22669
viewsNode.js - How to read user input from the console?
In Java: System.out.println("Diga algo: "); Scanner leitor = new Scanner(System.in); String resp = leitor.nextLine(); //ou nextInt, nextDouble, etc In C++ cout << "Diga algo: "; string name;…
-
8
votes2
answers431
viewsCheck if git is installed using Node
I’m starting in a desktop application with the use of Electron however I need to check if there is Git installed on the system because it must use git As the idea is to distribute on Windows, Linux…
-
8
votes1
answer178
viewsHow to improve this: Hell callback?
I am finishing the development of an ad system, the system uses the redis server to save data and display campaigns directly from ram memory, since the pathology of these systems require a lot of…
-
8
votes1
answer221
views -
8
votes3
answers281
viewsPick up reply email content
I’m using the library of imap to log into a company account and bring in the new emails, when it’s an email reply I’d like to pick up only the new content but I can’t get it just the full…
-
7
votes1
answer390
viewsHow to create a loop to send an event in socket.io?
I have an architectural problem. I have a code using socket. in nodejs: socket.on('images',function (aData){ ... socket.sockets.emit('show', JSON.stringify({imagens : json})) }); I’m trying to…
-
7
votes2
answers10840
viewsHow to read a large file row by row with Javascript (nodejs)
I have a very large file to import data to Mongodb via Javascript. The problem is that I cannot load the entire file into memory. I would like to read this file line by line, since each line is a…
-
7
votes2
answers7184
viewsHow to set a token in the header?
Well I use jwt to generate a token only that the example I was following didn’t show exactly how to paste the token into the application header. Would anyone know how? Note: I am using the express.…
-
7
votes1
answer751
viewsIs it possible to add Origin in the Header of a redirect according to the HTTP protocol?
I am implementing an application where I need to perform a redirect from one server to another and am encountering problems. While performing a redirect, receive the following error message:…
-
7
votes1
answer161
viewsEdgejs and Entity Framework
Next, I am learning Nodejs and I am delighted with the same, however I found my first stone on the way, access to relational database using some ORM (precisely to access Postgresql). Initially I…
-
7
votes1
answer1976
viewsField "__v" in all documents of a collection
All my documents in a Mongodb database have a field __v, what it means? > db.speeds.find({}).limit(2).pretty() { "_id" : ObjectId("586826f700890738a5e8cb3d"), "remoteId" : 1, "first" :…
-
7
votes1
answer2212
viewsAsynchronous function chaining alternatives
I need to perform 3 select. One in each table, and its precise result use in select remaining. In the original application, I do a lot of manipulations in the result of each query, which leaves a…
-
7
votes2
answers1557
viewsDoes Node.js compile the Javascript that runs on the server?
According to V8 documentation, it compiles Javascript for machine code, as an optimization strategy. Thus, the Javascript that runs on the server via Node.js is compiled or interpreted?…