Guest User

Untitled

a guest
Jun 28th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. const mysql = require('mysql');
  2. const config = require('./config')['production'];
  3.  
  4. const pool = mysql.createPool({
  5. connectionLimit: 1,
  6. socketPath: '/cloudsql/' + config.database.connection,
  7. user: config.database.user,
  8. password: config.database.password,
  9. database: config.database.name
  10. });
  11.  
  12. function getResults(req, res) {
  13. pool.query('select * from result;', (error, results) => {
  14. if (error) {
  15. console.log(error);
  16. }
  17. res.send(results);
  18. });
  19. }
Add Comment
Please, Sign In to add comment