feat: setup graphql server with neon relation resolvers
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
const { Pool } = require('pg');
|
||||
require('dotenv').config();
|
||||
|
||||
const pool = new Pool({
|
||||
connectionString: process.env.DATABASE_URL,
|
||||
ssl: {
|
||||
rejectUnauthorized: false,
|
||||
},
|
||||
});
|
||||
|
||||
async function test() {
|
||||
try {
|
||||
const res = await pool.query('SELECT NOW() AS server_time, COUNT(*) AS total_products FROM products');
|
||||
console.log('Koneksi Sukses!');
|
||||
console.log('Waktu DB Neon:', res.rows[0].server_time);
|
||||
console.log('Jumlah Data Produk:', res.rows[0].total_products);
|
||||
} catch (err) {
|
||||
console.error('Koneksi Gagal:', err.message);
|
||||
} finally {
|
||||
await pool.end();
|
||||
}
|
||||
}
|
||||
|
||||
test();
|
||||
Reference in New Issue
Block a user