node.js - Node MySQL Connection Not Working -


i new node express, have code connects mysql db...nothing happening when try 127.0.0.1:9080. i'm doing wrong can't figure out what...nothing in console no errors, tried in chrome, ff, safari , ie...any ideas.

var http = require('https'); var express = require('express'); var app = express(); var hbs = require('hbs');  var path = require('path'); var mysql = require('mysql'); app.set('view engine', 'html'); app.engine('html', hbs.__express); //mysql connect var connection = mysql.createconnection({     host : 'mysql://root@localhost/mydb2',   user : 'someone',   password : 'secret'   });  app.get('/', function(request, response) {   connection.query('select * sometable', function(err, rows){      if (err) throw err;  console.log("test01=" + row[0].tostring()); });   app.listen(9080); }); 

you need write in response see on browser.

add line before console.log() statement.

response.json(rows); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -