Skip to content
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

Question about prisma in nuxt #1

Open
Charly9978 opened this issue Apr 9, 2022 · 1 comment
Open

Question about prisma in nuxt #1

Charly9978 opened this issue Apr 9, 2022 · 1 comment

Comments

@Charly9978
Copy link

Hi,

I have a small question:

Why do you use prisma in the server/api and not directly in a component (with a composable for example)? What is the benefit to use a api?

Thanks for your help

Benjamin

@Pwuts
Copy link
Owner

Pwuts commented Apr 10, 2022

Hi Benjamin,

Prisma can't be used in components because the database connection is only available at the server, so the connection would fail client-side. Instead, Prisma is used server-side, API calls are routed internally on the server (thanks to Nitro) and done via HTTPS from the client.

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants