Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. 'use strict'
  2.  
  3. const mariadb = require('mariadb');
  4.  
  5. const pool = mariadb.createPool({
  6. host: 'localhost',
  7. user: 'root',
  8. password: 'yourpassword',
  9. database: 'lotto',
  10. connectionLimit: 5
  11. });
  12.  
  13. async function check(req, callback) {
  14. let conn;
  15. try {
  16. conn = await pool.getConnection();
  17. const rows = await conn.query("");
  18.  
  19. callback();
  20. } catch (err) {
  21. throw err;
  22. } finally {
  23. if (conn) return conn.end();
  24. }
  25. }
  26.  
  27. module.exports = {
  28. check
  29. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement