Node.js
1
Вклад в тег
const mysql = require('mysql2');
// create the connection to database
const connection = mysql.createConnection({
host: 'localhost',
user: 'root',
pass: 123,
database: 'test'
});
// simple query
connection.query(
'SELECT * FROM `table',
function(err, results, fields) {
console.log(results); // results contains rows returned by server
console.log(fields); // fields contains extra meta data about results, if available
}
);
request('http://music.com/givegonnagiveyouup')
.pipe(fs.createWriteStream('givegonnagiveyouup.mp3'))
fetch('http://music.com/givegonnagiveyouup')
.then(res => res.buffer())
.then(buffer => fs.writeFileSync('givegonnagiveyouup.mp3', buffer))
Authorization: Bearer <TOKEN>