var client = new pg.Client(clientConfig);
var queryConfig = {text: 'SELECT messageID FROM privateMessages WHERE message = $1',
values: ['test']};
var server = http.createServer(function(request, response) {
client.connect();
response.writeHead(200, {'content-type': 'text/html'});
client.query(queryConfig, function(err, result) {
if (err){
console.log("error");
}
response.end('You are visitor number');
});
client.end();
});
server.listen(3001)
正在进行的查询是有效的。但回调函数似乎不起作用。为什么不访问数据库?已尝试插入。