// сама функция взаимодействия с бд.
async function get_data_from_bd(sql){
return new Promise(function (resolve, reject) {
connection.query(sql, function (err, results) {
if (err) {
console.log('error sql: ', sql);
throw err;
}
return resolve(results);
// если это INSERT INTO, то возвращать return resolve(results.insertId);
})
})
}
// А это её вызов:
async function test(){
let sql = 'SELECT * FROM `user`'
data_bd = await get_data_from_bd(sql)
for(let i=0; i<data_bd.length; i++){
console.log(data_bd[i]);
}
}
let postData = new FormData();
postData.append('login', '');
postData.append('pass', '');
this.http.post('https://..../', postData).subscribe(data => {
console.log('true: ', data);
}, err => {
console.log('JS Call error: ', err);
});
var multer = require('multer')
var upload = multer({ dest: "./upload/" });
app.post('/get_message', upload.array(), async (req, res) => {
console.log('получил: ', req.body['здесь ключ']);
})
<div class="select-wrapper mdb-select md-form">
<span class="caret">Ў</span>
<input type="text" class="select-dropdown form-control" readonly="true" required="false" data-activates="select-options-1077e721-2657-48a3-9400-d2be89e4bfa8" value="">
<ul id="select-options-1077e721-2657-48a3-9400-d2be89e4bfa8" class="dropdown-content select-dropdown w-100" style="width: 237.547px; position: absolute; top: 0px; left: 0px; opacity: 1; display: none;">
<span class="search-wrap ml-2">
<div class="md-form mt-0">
<input type="text" class="search w-100 d-block" tabindex="-1" placeholder="Search here..">
</div>
</span>
<li class="disabled "><span class="filtrable"> Choose your country </span></li>
<li class=" optgroup-option "><span class="filtrable"> USA </span></li>
<li class=" optgroup-option "><span class="filtrable"> Germany </span></li>
<li class=" optgroup-option "><span class="filtrable"> France </span></li>