kickstart-express
Version:
A powerful CLI tool to quickly scaffold Express.js projects with modern tooling and best practices
19 lines (16 loc) • 511 B
text/typescript
import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
const connectionString = process.env.DATABASE_URL as string;
const client = postgres(connectionString);
const db = drizzle(client);
const connectDB = async (): Promise<void> => {
try {
// Test the connection
await client`SELECT 1`;
console.log('PostgreSQL connected via Drizzle');
} catch (error) {
console.error('Database connection error:', error);
process.exit(1);
}
};
export { db, connectDB };