Skip to content

Any way to connect from localhost? #33

@cosbgn

Description

@cosbgn

I would like to use an offline local instance of postgress while developing on my computer, I'm trying something like this:

import { neon, neonConfig } from '@neondatabase/serverless'
import { drizzle } from 'drizzle-orm/neon-http'
 import schema from "../database/schema.js"
neonConfig.fetchConnectionCache = true
let cached_db = null

const useDb = () => {
	if (!cached_db){
                const uri = process.dev ? 'postgresql://localhost:5432/dbname' : process.env.NEON_URI
		const client = neon(uri)
		cached_db = drizzle(client, {schema})
	}
	return cached_db
}

export const db = useDb()

But I keep getting an error that my uri is wrong

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions