nodejs連pgsql

var pgsql=require("pg");
var config={
	host:'localhost',
	port: 5432,
	user:'postgres',
	password:'123456',
	database:'postgres'
};
var pool=new pgsql.Pool(config);
pool.connect(function(err,client,done){
	client.query('select 1+1 as result',function(err,result){
		done();
		console.log("result is:",result.rows[0].result);
	})
})

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章