What driver i should use for Postgres? #9
-
I have my db in Postgres, what driver i should use, pg, node-postgres, vercel postgres? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You'll definitely need one that supports the Edge Runtime if you want to run everything on the Edge. Typically this requires a database provider which allows you to connect via HTTP rather than with a direct connection. This particular example only works because it uses Planetscale's database.js library, which connects to a PlanetScale HTTP endpoint that handles the translation from HTTP to raw MySQL for you. Vercel Postgres should work. Looks like Neon has an Edge-compatible driver as well. https://neon.tech/docs/serverless/serverless-driver |
Beta Was this translation helpful? Give feedback.
You'll definitely need one that supports the Edge Runtime if you want to run everything on the Edge. Typically this requires a database provider which allows you to connect via HTTP rather than with a direct connection. This particular example only works because it uses Planetscale's database.js library, which connects to a PlanetScale HTTP endpoint that handles the translation from HTTP to raw MySQL for you. Vercel Postgres should work. Looks like Neon has an Edge-compatible driver as well. https://neon.tech/docs/serverless/serverless-driver