Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var config = require('../config');
- var mysql = require('mysql');
- var dbInfos = config.dbConfig;
- var result = function(results)
- {
- return results;
- }
- var connect = function(query, result){
- var connection = mysql.createConnection({host: dbInfos.host, user: dbInfos.user, password: dbInfos.password, database: dbInfos.dbName});
- connection.connect();
- connection.query(query, function(error, results, fields){
- if(error) throw error;
- if(results.length === 0)
- return false;
- result(results);
- });
- connection.end();
- };
- module.exports = {
- result,
- connect
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement