Skip to content

Instantly share code, notes, and snippets.

@lennon03
Created August 26, 2025 10:00
Show Gist options
  • Save lennon03/ff8ac79cb3ad52dcea93ca5037ed42f6 to your computer and use it in GitHub Desktop.
Save lennon03/ff8ac79cb3ad52dcea93ca5037ed42f6 to your computer and use it in GitHub Desktop.
import { drizzle } from 'drizzle-orm/node-postgres';
import { usersTable } from '../db/schema';
import { Pool } from 'pg';
export async function load({ request, platform }) {
const pool = new Pool({
connectionString: platform!.env?.HYPERDRIVE?.connectionString
});
const db = drizzle({ client: pool });
const users = await db.select().from(userstable);
console.log(platform!.env.HYPERDRIVE.connectionString);
console.log('Getting all users from the database: ', users);
console.log(users);
return users[0];
}
// todo postgres.js driver
@lennon03
Copy link
Author

import postgres from 'postgres';
import { drizzle } from 'drizzle-orm/postgres-js';

const pool = postgres(process.env.DATABASE_URL as string, { max: 10 });
export const db = drizzle(pool, {
  schema: schema,
  logger: true,
});

the todo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment