Advertisement
Guest User

Untitled

a guest
Apr 15th, 2019
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const mysql = require('mysql');
  2.  
  3. const pool = mysql.createPool({
  4.     host: process.env.host,
  5.     user: process.env.user,
  6.     password: process.env.password,
  7.     database: process.env.database,
  8.     waitForConnections: true,
  9.     connectionLimit: 10,
  10.     queueLimit: 0
  11. });
  12.  
  13. if (!pool.getConnection(function(err) {console.error('Error connecting to database: ' + err.stack); return;})) {
  14.     return;
  15. }
  16.  
  17. console.info('Connected to database');
  18.  
  19. pool.query("SELECT * FROM societies");
  20.  
  21. module.exports = pool;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement