Closed wldbest closed 2 months ago
I have not tried yet, adding the enhancement label and will take a look once available.
To give an update, with the v0.7.5 you can now use the postgres package:
// server/api/products.get.ts
import postgres from 'postgres'
export default eventHandler(async (event) => {
const sql = postgres(process.env.NUXT_DB_URL as string, {
ssl: 'require'
})
const products = await sql`SELECT * FROM products`
// Close the connection after the response
event.waitUntil(sql.end())
return products
})
Postgres & Hyperdrive recipe is live: https://hub.nuxt.com/docs/recipes/postgres
Can I use NuxtHub with Hyperdrive? I want to connect Postgresql in workers (for vector queries), but the only way seems to be using Cloudflare Hyperdrive.
When I try to use worker & Hyperdrive in Nuxt environment, local Postgres drivers like 'postgres, pg' seem to block the build process. So I couldn't succeed Nuxt + Hyperdrive in workers environment. (I remember it were win-socket errors. I host my Postgres in arm ubuntu docker at Oracle cloud (4 CPU, 24GB), local develop: windows10)
Is there any way to use Nuxt(NuxtHub) with Hyperdrive? Thanks in advance.