What is the best way to connect postgres to express

import express from “express”;
import pkg from “pg”;

const { Pool } = pkg;
const app = express();
app.use(express.json());

const pool = new Pool({
connectionString: process.env.DAimport express from “express”;

import pkg from “pg”;

const { Pool } = pkg;

const app = express();

app.use(express.json());

const pool = new Pool({

connectionString: process.env.DATABASE_URL,

});

app.post(“/signup”, async (req, res) => {

const { email } = req.body;

if (!email) {

return res.status(400).json({ error: "Email required" });

}

await pool.query(

"INSERT INTO fans (email) VALUES ($1)",

\[email\]

);

res.json({ success: true });

});

app.get(“/”, (req, res) => {

res.send(“187 Certified backend running”);

});

app.listen(3000, () => {

console.log(“Server live”);

});