feat: setup graphql server with neon relation resolvers

This commit is contained in:
MelvynFaith
2026-09-09 16:44:06 +07:00
commit 4dc4a1f716
5 changed files with 1673 additions and 0 deletions
+24
View File
@@ -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();