Answer the question
In order to leave comments, you need to log in
How to work properly in Node js?
Hello uv. community. Please tell me, using an example, how to work correctly in Node js.
Here is the code:
var config = require('./config');
var query = require('./mysql').query;
var res;
query('SELECT test FROM test WHERE id=1 LIMIT 1').then(function (result) {
if(result){
res = result[0].test;
console.log("result = "+res);
}
}).catch(function (err) {
console.log('Error');
console.log(err);
});
console.log("result out = "+res);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question