Linked Questions
66 questions linked to/from What is the difference between synchronous and asynchronous programming (in node.js)
0
votes
1
answer
215
views
Handling variable assignment using callbacks in Javascript? [duplicate]
I've recently picked up Node and see that things don't always run sequentially. I'm pretty confused as I'm used to
1) Assignment
2) Print data
Current I'm running the below function and calling var ...
0
votes
1
answer
106
views
Javascript Nodejs Value not pushing into array [duplicate]
module.exports.findUser = function(query){
var result = [];
User.find(query, function(err, data){
result.push(data);
});
return result;
}
I try to push the data array into result, but ...
350
votes
9
answers
117k
views
How the single threaded non blocking IO model works in Node.js
I'm not a Node programmer, but I'm interested in how the single-threaded non-blocking IO model works.
After I read the article understanding-the-node-js-event-loop, I'm really confused about it.
It ...
118
votes
8
answers
391k
views
loading json data from local file into React JS
I have a React component and I want to load in my JSON data from a file. The console log currently doesn't work, even though I'm creating the variable data as a global
'use strict';
var React = ...
6
votes
2
answers
26k
views
node.js get result from mysql query
why I cannot get results?
var sql_data = connection.query(sql, function(error, results, fields) {
if(error) {
console.log(error);
return;
}
var rows = JSON.parse(JSON....
8
votes
2
answers
12k
views
Is Array.forEach asynchronous?
According to JavaScript, Node.js: is Array.forEach asynchronous?, Array.forEach is synchronous. However, for my code below:
function wait5() {
return new Promise(resolve =>
setTimeout(...
4
votes
2
answers
5k
views
Difference between fs.exists and fs.existsSync
While working with the file I/O for node I found these two functions(fs.exists and fs.existsSync) to check if a file exists in the system. What are the differences between them?
3
votes
2
answers
10k
views
Displaying data from a Mongodb collection in ejs using Mongoose
I am brand new to programming. I have a collection called "Practice" in my local database which has "name, role, org". I am trying to figure out how to print this info in a .ejs file using mongoose.
...
7
votes
2
answers
3k
views
update with upsert: true is not updating in express,mongoose?
var logs = [{
mobilenumber: '1',
ref: 3,
points: 1000,
ctype: 'mycredit',
entry: 'sdfsdf',
entry: 0
}, {
mobilenumber: '1',
ref: 6,
points: 2000,
...
7
votes
2
answers
2k
views
why use sync functions node.js
Everyone recommends using async (non-blocking) functions instead of sync functions in Node.js .
So whats the use of sync functions in node.js if they are not recommended?
For example : Why use fs....
2
votes
3
answers
7k
views
Performing Sync Get request using Node.js
I am trying to get the response received from the server in the same order as there url's were passed as command line arguments.But it does not perform sync operation please help.
I am relatively new ...
3
votes
2
answers
4k
views
Difference between synchronous and asynchronous functions
I have just started react-native development and came across async functions. Can someone explain a thing or two about it in layman's terms. I have tried reading articles on it but they all tend to ...
2
votes
2
answers
5k
views
How can I update Vue immediately after an axios call?
I need to update my variable this.xCtesPorRuta immediately after an axios call so I can show some info from the database on an element like a select. The axios call is activated with a button's v-on:...
1
vote
1
answer
5k
views
JavaScript nested fetch API
I started working on an android app. I am at the point that i need to use an API to get some info. I am using an API for movies so it contains id, title and some other info. My problem is that in this ...
2
votes
2
answers
2k
views
Node js: Express js asynchronous db query execution-return results got undefiend
Just started to learn express js framework ,here is my simple database query execution part its invoked with this url localhost:3000/api/test.
db.query('SELECT * FROM user', function (error, results, ...