-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconnection.js
More file actions
34 lines (31 loc) · 740 Bytes
/
connection.js
File metadata and controls
34 lines (31 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const express = require('express');
const app = express();
const bodyParser = require('body-parser')
const { Pool, Client } = require('pg')
const port = 4000;
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({
extended: true,
}))
const pool = new Pool({
Server: "localhost",
Database: "postgres",
Port : 5432,
Username : "postgres",
Password :"vip#@990",
})
const getUsers = (request,response)=>{
pool.query('SELECT * FROM country',(err,result)=>{
if(err){
throw err;
}
else{console.log("connection done");}
})
}
app.get('/',(req,res)=>{
res.json({info:"who the fuck are you"})
})
app.listen(port,()=>{
console.log("Server is Running")
})
getUsers();