var http = require('http')
var mysql = require('mysql')
var connection = mysql.createConnection({
host: '121.42.151.190',
user: 'root',
password: 'jkxyx205',
database: 'medical'
})
http.createServer(function(req, res) {
if ("/favicon.ico" !== req.url) {
res.writeHeader(200, {"Content-Type": "text/plain"})
connection.query("SELECT username, truename, email, mobile FROM user where id = '160' or id = '169'",
function(err, rows, fields) {
rows.forEach(function(item) {
console.log(item.username);
})
res.write(JSON.stringify(rows));
res.end()
})
}
}).listen(3000)
console.log("server start at port 3000... ");