$50 Metal Postgres databases are here. Learn more
Navigation

Neon serverless driver HTTP mode support

PlanetScale now supports HTTP mode for the Neon serverless driver, in addition to the existing WebSocket support. HTTP mode enables simple, one-shot queries over HTTP, making it ideal for edge and serverless environments like Cloudflare Workers and Vercel Edge Functions.

import { neon, neonConfig } from '@neondatabase/serverless'

neonConfig.fetchEndpoint = (host) => `https://${host}/sql`

const sql = neon(process.env.DATABASE_URL!)
const posts = await sql`SELECT * FROM posts WHERE id = ${postId}`

Read more