-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Cloudflare Hyperdrive connection in Nuxt-hub #208
Labels
enhancement
New feature or request
Comments
wldbest
changed the title
Support Hyperdrive connection in Nuxt-hub
Support Cloudflare Hyperdrive connection in Nuxt-hub
Jul 25, 2024
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The text was updated successfully, but these errors were encountered: