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
-
2
votes2
answers289
viewsExpress How to make a div appear only if the user is logged in?
Well, I just made the registration on my site and I would like that when the user logged in the login and registration links disappear and in the place appears a div with a drop menu showing links…
-
2
votes1
answer308
viewsHow to recall the function without losing the Precedent?
I’m still beginner in Node.Js, and do not know how to do this operation. In the code below to realize that the function readSubscriptions() is called right after function login(). But if there is an…
-
2
votes1
answer809
viewsPass parameters via POST with Node.js
I’m trying to access a service that returns an XML Description of service and there it says that I have to inform some parameters via POST. It’s the first time I’m having to do this and I’m not…
node.jsasked 6 years, 10 months ago Wind Check 31 -
2
votes0
answers137
viewsHTTP file streaming on Node
Hello, I am developing a system in which one of the fundamental parts is to transmit a file via Node JS. Suppose I have one connection to, this connection is uploading a file via HTTP. And there’s…
-
2
votes1
answer99
viewsNodejs: Difference between requests (require)
I started learning Nodejs and noticed that there are some ways to request a file, two of them are: const app = require('lib').app const {app} = require('lib') Is there any difference between them in…
-
2
votes1
answer85
viewsConvert a stream to string?
I’m taking emails from the inbox of an account I created for testing, I’m tracking them with the Node-imap and parse them with the Mailparser and I am able to recover most of the information I need,…
-
2
votes2
answers586
viewsScope between variables - Javascript
Hello! I’m studying Javascript and I have a question. I come from a world called Java and there are private access modifiers, protected, public and even variable without modifier declaration; and…
-
2
votes1
answer284
viewsAdd variables to columns (Mysql)
I have a question, it is possible to add variables in a column? Codigo Test var sql = "INSERT INTO sometable (someparam) VALUES (varToParam)"; con.query(sql, function (err, result) { if (err) throw…
-
2
votes1
answer148
viewsHow to use foreign key to create a record in another table
I have two tables users and users_info, would like to use foreign key, for when I create a record in the table users, create a record with the empty fields in the table users_info, only with the…
-
2
votes1
answer1686
viewsUncaught Syntaxerror: Unexpected token Nodejs
I cannot properly link my Static/index files, follow the code directory: 'blog/createServer.js' var http = require('http'); var fs = require('fs'); var path = require('path'); var contentTypes = {…
-
2
votes3
answers887
viewsFIREBASE + NODEJS error: Firebase App named '[DEFAULT]' already exists
I have a CRUD made with NODEJS + EXPRESS, using FIREBASE. I add a record normally, but when I add the next one, it gives me the error: [DEFAULT]: Firebase: Firebase App named '[DEFAULT]' already…
-
2
votes1
answer29
viewsNodejs module running before the Eventlistener
I’m creating a module for node and by performing some tests with the eventListener of the kind change in a field of the kind file, the module is executed before a frame is inserted into the field.…
-
2
votes1
answer1008
viewsVideo stream with Nodejs and Socket.io
I need help to stream with Nodejs and Socket.io. I’m using the rtsp-ffmpeg library to stream. I was able to execute it transmitting in img format according to the specific documentation itself, but…
-
2
votes0
answers84
viewsUpload two files from two different Fields with multer
Using the ladies I am trying to upload two different files that comes from Fields in forms different and has different storage path also: let storageAudios = multer.diskStorage({ destination: (req,…
-
2
votes1
answer75
viewsUnexpected behavior in asynchronous javascript
I am writing backend code using javascript, Node and npm 'mysql' and 'request' modules. I tried to write a module to make a pooling of SQL database connections by different API calls in various…
-
2
votes1
answer956
viewsWhy and when to use "res.send()" in an application? Nodejs and Express
Well, I’m a beginner in Nodejs and started studying for academic purposes. In another question I asked here at SO-BR (What is the "res.send()" command for in Express?) I asked what this command was…
-
2
votes1
answer702
viewsConstruct an Array with the date range
I will receive two dates, Example: 01/10/2017, 31/10/2017. How can I create an array with every day between these dates. Array = ["01/10/2017", "02/10/2017", "03/10/2017", ... ,"31/10/2017"]…
-
2
votes0
answers68
viewsDoubt: Web Sockets and how to use
I was seeing this question link. Then I did not read in the answer about nodejs and researched about, but I did not understand much. How to apply this technology (nodejs)? I am developing a site in…
-
2
votes1
answer113
viewsSearch and replace mongodb database
I have several collections in mongodb and would like to do a "search/replace" for all collections and for each field that is the string "http:" replace with "https:" Example: var object = { "_id" :…
-
2
votes1
answer4927
viewsPass variable to html page with Nodejs
Guys I made a list of files that exist in a certain folder, I would like after listing, It was possible to access this variable in HTML. Server.js var http = require('http'); var arquivo =…
-
2
votes1
answer199
viewsHow to make an Amazon EC2 instance listen to the 5000 port via HTTP?
An instance EC2 Ubuntu that has installed Nodejs with an app that responds on port 5000 with the Node command. I started the Nodejs node app.js through the terminal (ssh) and tried to access through…
-
2
votes2
answers460
viewsUse 2 different frameworks in the same CSS?
I started my internship today and the first task I received was to find out if it is possible to use two files in a minified CSS. About minificar I’ve already learned using node and gulp, I’ll use…
-
2
votes0
answers177
viewsHow to popular a sub list of a document with Mongoose?
Is it possible to popular a list that references another list in the same document? Example in the image below, I want to popular/return in a search always the access link referring to another list…
-
2
votes2
answers167
viewsHTML to open url stored in a variable
I don’t have much knowledge in html, I want to open a link that is stored in a variable but unsuccessfully. <div class="csgo-item--inspectLink"> <img src="static/img/inspect.png"…
-
2
votes2
answers1240
viewsIs there a way to auto-increment the id in Mongo?
You can do this, every time I create a new user for example it auto increments _id. Starting from 1 and going up to the number of users
-
2
votes1
answer5206
viewsRemove simple javascript quotes
I need to remove simple quotes from a string, I’ve tried string.replace(/\'/g, ''), .replace(/"'"/g, '') and it doesn’t work, someone can help me?
-
2
votes1
answer197
viewsHow can I reduce this line of code in javascript?
I have a file like this: <html> <script> var a = document.createElement('script'); a.src = 'js/index.js'; document.getElementsByTagName('html')[0].appendChild(a); </script>…
-
2
votes0
answers888
viewsWhat are the main project standards in NODEJS for Web Development?
I am starting my studies in Nodejs and need to know what the main project standards for Web Development in Nodejs.
-
2
votes1
answer260
viewsSplit text
I need to take a specific piece of a file . txt that is between <tag> and </tag>. But I need to get all the lines where it happens. Example: <tag1>titulo</tag1>…
-
2
votes1
answer547
viewsReturn module.Exports values by Return
I have the following code that the data are returning right by console.log() var request = require("request"); var myJSON = require("JSON"); function resultado(url, callback) { request({ url: url,…
-
2
votes0
answers366
viewsHow to package Electron application for windows
currently create an application with Electron, the way I added external javascript scripts with scriptsrc to work on both Electron and a web page. but I’m having trouble generating the executable…
-
2
votes1
answer218
viewsGit Terminal vs Node Terminal vs Windows Terminal
I’m having some difficulty realizing the need to have so many terminals installed on the computer when I need to use git or Node.js. What are the differences between the terminals, what can one do…
-
2
votes1
answer927
viewsRead row by row from file . txt
I am trying to read a file . txt from 3.5GB line to line and save to Mongo db. The columns use the "|" tab and I am using Node js with Express. I did the test with a file smaller than 43 lines and…
-
2
votes1
answer104
viewsNodejs api with Promisses
I am developing an API in Typescript with Nodejs and Mariadb; when I do an operation with the bank, below I have a if to check if an error has occurred. productDao.save({name:"Notebook Dell",…
-
2
votes0
answers223
viewsHow to check if the EJS is rspondendo
My app is Ode with express and ejs 1 - It is running index.html and not index.ejs 2 I am unable to pass the title or title parameter to the view neither in ejs nor in html app.js and index.ejs are…
-
2
votes1
answer523
viewsHow to use other HTTP methods in HTML forms?
I’m using Express.JS to make a CRUD in Nodejs. I was trying to make use of the new HTTP methods, such as put , but when I put it in the attribute method of the apparently not certain form. The code…
-
2
votes2
answers1155
viewsMysql with Nodejs: insertion of records
I created a script called 'test.js" just to demonstrate a simple insertion of log records into a Mysql database, using Nodejs, as follows. Will be generated around 5 logs per second, which makes me…
-
2
votes1
answer33
viewsHow to ensure data entry and update in different databases
I’m developing an application with a microservice architecture and a question has arisen. Each application functionality will have an isolated API, how can I ensure that when making an Insert/update…
-
2
votes1
answer276
viewsHow do I deploy an Angular app to Heroku using Gitlab?
Angular Use 5 (5.2.10) and Angular CLI (1.7.4) and I would like to deploy to Heroku, but my files are in the Gitlab repository. Some more information: Node (8.11.1) and npm (5.6.0).
-
2
votes1
answer132
viewsWhat are the best practices for putting mongoDB into production?
I am studying Ode.js, and in most courses the staff uses mongoDB, I really enjoyed working with it, very simple and practical, but I have some questions: Nowadays, most hostels already support…
-
2
votes1
answer168
viewsProduction vs Development - WEBPACK
I would like to know the difference between the modes of "Development" and "Production" within Webpack4.
-
2
votes1
answer232
viewsMongodb seeks to return internal arrays
Example of structure: { "_id" : ObjectId("598d4eb912f28534d80a5820"), "nome" : "Emilio", "produtos" : [ { "_id" : ObjectId("598d4fb912f28534d80a5821"), "nome" : "produto1" }, { "_id" :…
-
2
votes0
answers183
viewsConfiguration of Response Headers
I created an Express server and my client in Quasar/Vuejs. I need to send a PDF to my client, the PDF in question is already created on the server, but I am facing problems to send it to the client.…
-
2
votes1
answer556
viewsCorrupted PDF after download?
I am generating PDF’s of the data I have in a table in my client, send the data to the server and there is generated PDF. After it is ready, the PDF download takes place, and it is at this stage of…
-
2
votes1
answer827
viewsHow to view files before downloading?
I want a PDF (generated on my server) sent to my client and opened in a new tab before it is downloaded. I have already managed to have it downloaded directly when it comes from the server to the…
-
2
votes1
answer210
viewsRename Pdf file before opening for preview
I am receiving a PDF file in the Answer of a POST request, and on the server side I have configured the file name and everything else. But now I’m visualizing it in the browser instead of…
-
2
votes1
answer1871
viewsUse delete method with express
Hello, I’m trying to send a value of a form (id) that will be handled by express (I don’t know the technical terms for this, if you can help me too), I’ve looked a lot but I can’t pass the id…
-
2
votes1
answer159
viewsProblem when executing a query in a repeat loop on the Mssql Node
So, I am using Node and mssql package (sql-server) to perform queries to my database. however I am facing a difficulty to return queries that need to be executed within a repeat loop. Maybe it’s…
-
2
votes0
answers25
viewsAvoid route authentication late with JWT
The JWT allows us through the method unless inform Urls and request methods that no authentication should be required. But as far as I know it is necessary to do this when Middleware is informed to…
-
2
votes1
answer218
viewsBasic Nodejs Authentication
I’m starting now with Nodejs (I came from PHP), and I’m creating an API for an app of mine, I wonder, how do I make the queries based on Auth Basic, I don’t know very well how it works (I’ve already…