Skip to main content
Glama
postgres.ts607 B
// src/db/providers/postgres.ts import { Pool } from 'pg'; import type { DB } from '../provider.js'; export default function createPostgresDb(): DB { const pool = new Pool({ connectionString: process.env.DATABASE_URL! }); return { dialect: 'pg', async query(text, params?: any) { // Your param mapper should already convert :name → $1,$2 and give an array const res = await pool.query(text, Array.isArray(params) ? params : undefined); return { rows: res.rows, rowCount: res.rowCount ?? res.rows.length }; }, async close() { await pool.end(); }, }; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Muhammad-Idzhans/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server