Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const mysql = require('mysql');
- const config = require('./config')['production'];
- const pool = mysql.createPool({
- connectionLimit: 1,
- socketPath: '/cloudsql/' + config.database.connection,
- user: config.database.user,
- password: config.database.password,
- database: config.database.name
- });
- function getResults(req, res) {
- pool.query('select * from result;', (error, results) => {
- if (error) {
- console.log(error);
- }
- res.send(results);
- });
- }
Add Comment
Please, Sign In to add comment