0

I want to use drizzle ORM to connect my PlanetScale database

I am using nuxt.js 3. Should I put this code provided by drizzle ORM into the nuxt plugin folder?

const connection = connect({
    host: process.env["DATABASE_HOST"],
    username: process.env["DATABASE_USERNAME"],
    password: process.env["DATABASE_PASSWORD"],
});

const db = drizzle(connection);

Should this be a plugin? I am not sure what plugins are. I think they are functions that are executed when npm run start.

How to export db and other schemas. I want to use db in many files so I want to export it. But the plugin seems that it needs to export a default function. How to do the export thing

If it's not a plugin, where should I put these codes.

seki
  • 19
  • 3

0 Answers0