본문 바로가기
Programming/JAVASCRIPT

Javascript postgresql 연동

by Wilkyway 2020. 6. 29.
const { Client } = require('pg');

const client = new Client({
    host : 'localhost',
    database: 'postgres',
    user: 'postgres',    
    password: 'asdf4416',
    port: 5432,
});

client.connect();

client.query('SELECT * FROM member', (err, res) =>{
    if(err){
        console.log(err);
    }else{
        console.log(res);
    }
});

댓글0