{"size": 810, "ext": "js", "max_stars_repo_path": "back/helpers/database.js", "max_stars_repo_name": "MelaRoussel/memory-react-node", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "back/helpers/database.js", "max_issues_repo_name": "MelaRoussel/memory-react-node", "max_issues_repo_issues_event_min_datetime": "2021-09-02T04:55:06.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-18T18:13:55.000Z", "max_forks_repo_path": "back/helpers/database.js", "max_forks_repo_name": "Melayoa/memory-react-node", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 3, "max_forks_count": null, "avg_line_length": 35.2173913043, "max_line_length": 99, "alphanum_fraction": 0.7308641975}
//Je déclare la librairie mysql que je vais utiliser pour me connecter à ma base de données
const mysql = require('mysql');
//J'utilise createConnection de la librairie mysql afin de définir mes paramètres de connexion
const connection = mysql.createConnection({
	multipleStatements: true,
	host: 'localhost',
	port: '3306',
	user: 'root',
	password: 'root',
	database: 'memory_db'
});
// Quand je me connecte je fais un log sur mon terminal pour connaître l'état de ma base de données
connection.connect((err) => {
	if (!err) {
		//Je suis connecté
		console.log('Database is connected');
	} else {
		//Oups il y a une erreur, et on affiche l'erreur pour pouvoir debugger.
		console.log('No connection with database', err);
	}
});
//J'exporte mon module afin de pouvoir l'utiliser
module.exports = connection;