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
-
3
votes1
answer64
viewsDifference in Socket.io declaration
I’m starting to work with Socket.io on Node.js, the doubt for now follows simple. Using my example below. What’s the difference in using socket.Emit() and chat.Emit()? PS:*I hope you don’t have a…
-
3
votes2
answers122
viewsServer side timer, huh?
I am making a game of questions in PHP, the user will have 15 seconds to answer each question, how to prevent the user to change the timer via inspect element and add seconds? Just adding details,…
-
3
votes1
answer2858
viewsNode.js - Get input values?
There I go again. I have a function where a registration in the Mysql database is working. But while trying to get the data from an input I get the following error: Typeerror: Cannot read Property…
-
3
votes2
answers11548
viewsHow to remove unused packages in the node_modules folder with the NPM command?
I installed some packages from NodeJS via npm install. But then I decided to remove some. Even when I install again, the folders of the packages I’m not using remain there. In the composer PHP, when…
-
3
votes2
answers2055
viewsError finding Nodejs module
I’m following a book by NodeJS and is making the following mistake: Error: Cannot find module './app/routes/home' I’ve gone over and over and found nothing wrong, here’s the code: Express.js //…
-
3
votes1
answer434
viewsUndefined Object
I’m having problems with an object on Node.Js with Express.Js. He is reporting the following error. Error: Route.get() requires callback functions but got a [object Undefined] at…
-
3
votes1
answer663
viewsHow the Express Router function works
To use a middleware in Express, I do as the code below: var express = require('express'); var app = express(); app.use('/', function(req, res, next) { console.log('Middleware!'); }); However, I…
-
3
votes1
answer255
viewsError installing phonegap by npm
This is the problem that has occurred, I tried to install Gyp and did not solve, someone would explain me what is happening please. [email protected] install…
-
3
votes1
answer140
viewsHow to use Try/Catch to read files
I have a method called readFileCredentials which aims to open a file and return the data that was inside that file, follows the code of that method: readFileCredentials = function(file, cb){ var…
-
3
votes1
answer416
viewsSecurity when sending and taking data from a URL
Hello, I’m learning development and I don’t know much about security. I’m making a web application using Nodejs + Expressjs + AngularJs + MongoDB. I did it this way, Mongodb data is sent to a URL…
-
3
votes1
answer1801
viewsTotvs Fluig - Customization - Call in REST service in beforeSendData event
Does anyone know how to make a call to a REST service within the beforeSendData event, follow below my code (not functional): My goal is to run a call on a REST service of the fluig itself in order…
-
3
votes1
answer575
viewsNginx - running php app and Node on the same domain with different ports
I am configuring a Blocks in Nginx, but I’m having difficulty running two different apps, see the following situation: I have 2 apps (PHP and Node.js) only one domain (example.com.br) and I need to…
-
3
votes0
answers80
viewsDoubt with nodejs: receive email
I appreciate anyone who can help. I’m using this code: client.openMailbox("INBOX", function(error, info){ if(error) throw error; var ex; client.listMessages(-10, function(err, messages){…
node.jsasked 8 years ago Ansumane Sambu 31 -
3
votes1
answer139
viewsProblem Code Nodejs multiplayer game
Hello, I’m having trouble creating a real-time game with Node.js, below is the client part: var position = {x:0, y:0}; var canvas = document.querySelector("canvas"); var context =…
-
3
votes2
answers1523
viewsHow do asymmetric signatures work in JSON Webtokens (JWT)?
I recently started to study the possibility of starting to use JSON Webtokens in my projects, given their advantages. From what I understand, there is a symmetrical form and an asymmetric way of…
-
3
votes0
answers604
viewsCan I access database using Electron js?
Can I access database with Electron js, is there any limitation in its use? if yes which?
-
3
votes1
answer4084
viewsBack-end applications with Node.js
I’ve seen some lectures on the Node.js, its capacity, usability, market, etc... But all this information was very "scrambled" for me, and I always had a somewhat vague thought about it. What I know,…
-
3
votes0
answers100
viewsProblem with the redirect
I am creating an application in Node.js using express admin to manage data. It ran great as locally, but when I put in apache server the redirect to login gives error. In case, when I went to…
-
3
votes1
answer2466
viewsCreate . bat file to open Node.js terminal and run one or more commands
I would like to create a file . bat to automate a process I have to perform every day. Whenever I start working, I open the nodejs terminal, access my project directory (in my case I use Babel) and…
-
3
votes1
answer262
viewsIntegrate nodejs (frontend) and C ,Erlang, Go...(backend)
I have a system to be developed that will need to handle a lot of simultaneous requests, where each of these requests will probably involve some task that requires a lot of processing. Researching…
-
3
votes1
answer1878
viewsCommand "npm" not working properly on Windows 8.1 Single Language x64
I’m executing the command npm in the CMD but there is no return, even when I ask to display the version of npm, I already gave full permission in the folder of nodejs, I’ve already done a simple…
-
3
votes1
answer140
views{} at require() return
I’m creating a module, but when I use it, I get an empty object in require() Codes below: dev/index.js module.exports = () => { 'use strict'; const names = require('./names.js'), findSuperman =…
-
3
votes3
answers734
viewsMysql query with subquery in Nodejs
I have the following structure in the following tables. partner (idParceiro, name, email, phone) example partnerTag (idPartner, tag) What I need to do, a select in the partner table and do a for in…
-
3
votes1
answer129
viewsLost variable value ( Javascript )
I have this class, but every time I ask, and access the value of fb_firstNameis 'Undefined'. What I’m doing wrong? inside the set method, setFb_firstName(firstName) the value is correct, but when…
-
3
votes1
answer1698
viewsRoutes in separate files
How do I put routes in separate files? var express = require('express'); var App = express.Router(); var Notas = require('../api/notas'); App.route('/notas') .get(Notas.read) .post(Notas.create);…
-
3
votes2
answers7656
viewsGo through all keys of a json
I want to go through all the keys of a json so I can get all of its values. Ex: { "logistics_provider": "{{lp_name}}", "shipper": "{{co_common_name}}", "invoice_key": "{{ae_identifier}}",…
-
3
votes1
answer136
viewsObject creation (Factory) javascript
Hello, I’m having to try to create two objects of the kind person using Factory and in the first attempt I create the first element and the second attempt instead of creating the second element…
-
3
votes2
answers639
viewsPassword authentication Nodejs
I’m starting now with Nodejs and am following a password authentication tutorial. However, I’m not being able to call the method that compares passwords. In my model, I have this structure: var…
node.jsasked 7 years, 11 months ago Daniel Swater 1,251 -
3
votes1
answer1721
viewsCreate splash screen in the Electron application
I need to create a kind of Splash Screen for an application on the Electron. The organization would look something like this: Inicialização do App; Abrir a splashWindow (uma página frameless) por 3…
-
3
votes1
answer1199
viewspass variables to EJS view of separate queries
I’m starting with Node/express etc. Create a website with the intention of learning and I’m in need of help. I have a mysql query that is sent to an EJS view via the code below: app.get('/',…
-
3
votes4
answers1986
viewsWhere does JWT keep the tokens?
I am following the following tutorial to create an authentication system using Node.js and JWT: https://scotch.io/tutorials/authenticate-a-node-js-api-with-json-web-tokens By following the steps of…
-
3
votes1
answer576
viewsHow to search for the longest date in Mongodb along with other parameters?
I have a schema date, status and code: var entregaSchema = mongoose.Schema({ codEntrega: String, placaPipa: String, codRota: String, codMA: String, dataMA: Date, localMA: String, codPA: String,…
-
3
votes1
answer649
viewsHow to change a record in Mongo through a function and update Node?
I have a problem. I have a dataset inside Mongo, a json that has been returned from a url request pa/ with app.get('/pa', function (req, res) { paController.list(function(resp) { res.jsonp(resp);…
-
3
votes1
answer104
viewsWhat does that expression mean?
Studying a little the Node-Red I came across the following expression, {{#header.url}. Several expressions of the type are present in the code, for example: {{/header.url}}, {{#header.image}}, etc.…
-
3
votes1
answer573
viewsDifferences between authentication types
I was doing some research on authentication, because I want to improve this part of my system, I found some cases like Basic, oAuth1 and Oauth2. What is the difference between them? What are they…
-
3
votes3
answers414
viewsHow to remove specific word from string?
I have an input where the user can enter the site itself, and insert http:// when writing to db, but I would like to treat so that if there is already this tag in the input it does not enter again,…
-
3
votes1
answer408
viewsNodejs - How to use external variables in asynchronous functions
I’m starting to node and I still find the concept of asynchronous functions complicated. I am using and js to render templates to e-mail in my application. The prototype is: "use strict"; const…
-
3
votes2
answers497
viewsHow to reload the page in Express / nodejs
I created a new project with Express and Nodejs, where I set a "/status" route. Each time this route is accessed, you must execute a routine in the script /routes/status.js. Example: If I run a F5…
-
3
votes2
answers2000
viewsGenerate and format dates with Moment in Nodejs
I’m trying to use the Moment for formatting dates this way YYYY-MM-DD HH:mm:ss and would like to determine a period between 00:00:00 yesterday and 23:59:59 today. Example: considering today as…
-
3
votes1
answer43
viewsProblem when installing Hiredis module
I was installing the module npm Hiredis, but I had problems. According to your documentation, the only necessary prerequisite is the presence of Python 2.7 and of gcc / g++ 4.8, which I already…
-
3
votes1
answer102
viewsImporting files without naming with Nodejs
I am creating a file structure in an application where each directory contains an "index" file. This index file takes the name of my directory to improve readability. Ex: foo |--foo.js // <-…
-
3
votes1
answer167
viewsUse if() inside . catch() - error: Unexpected token if
Is the following I am new to javascript and I am not able to handle this error. I am trying to call a function and putting a .catch() to avoid error UnhandledPromiseRejectionWarning soon after it,…
-
3
votes1
answer851
viewsHow to pick up a specific piece of information within a Json with Node.JS?
{ "pair": "BTCBRL", "bids": [ [2257.89, 0.20752212, 90852987], [2257.88, 1.01201126, 90800395], [2249.98, 0.05052466, 90806289] ], "asks": [ [2272.14, 2.3648572, 90803493], [2279.63, 0.08722052,…
-
3
votes1
answer1024
viewsUsing a root directory in the Nodejs include
I am learning Nodejs and I started to create a project just to get used to developing with him, however, I am bothered by the amount of ../../../../../ used when including a code. How can I use my…
-
3
votes2
answers159
viewsnodejs installation on Ubuntu
In ubuntus the Node.JS package was renamed to nodejs pq already existed another Node package. How do I make npm understand that nodejs is already installed on the system, but the name of different?…
-
3
votes1
answer609
viewsError while trying to run Ionic serves windows
When I try to start my Ionic project this giving the following error: 0 info it worked if it ends with ok 1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe', 1 verbose cli 'C:\\Program…
-
3
votes1
answer225
viewsCopy directory to an ftp server using nodejs
I am developing an application in nodejs where I need to access an ftp server and send some folders there. Before putting these folders, I want to backup the folders on the server. How can I copy a…
-
3
votes1
answer273
viewsError while uploading a Nodejs application to Heroku
While performing the eating: git push heroku master LOG: -----> Node.js app detected parse error: Unfinished string ! Unable to parse package.json -----> Build failed We're sorry this build is…
-
3
votes1
answer774
viewsMonitor file and or directory
I have this method that performs the reading of the file const fs = require('fs'); const path = require('path'); let arquivo = path.join(__dirname, 'arquivo.txt'); fs.readFile(arquivo, { encoding:…
node.jsasked 6 years, 7 months ago NoobSaibot 9,554 -
3
votes1
answer115
viewsHow to send a video via POST?
I have an application that is being written in Node.js and using Electron, I need to send a video in mp4 format via POST to the server. How can I do that? EDIT 1: In the app, I use Ffmpeg to create…