1234567891011121314151617 |
- const pgp = require('pg-promise')();
- // 连接到数据库
- var PgInstanse;
- const pgClient = function(){
- if(!PgInstanse){
- PgInstanse = pgp({
- user: 'postgres',
- password: 'postgres',
- host: 'localhost',
- port: 25432,
- database: 'postgres'
- });
- }
- return PgInstanse;
- }
- module.exports.pgClient = pgClient
|