13 Replies
you try to use postgres on the client side? π€
the only place i reference postgres is in
src/server/db/index.ts
how do i know if i'm on the client or server side?where do you use server/db/index.ts?
http://localhost:3000/_nuxt/@fs/C:/Users/ethan/Desktop/Projects/watchdog/website/node_modules/.cache/vite/client/deps/postgres.js?v=9ecbf21c:617:14
looks like it is part of the client. Most vite-related things areall i have in that file is
and where do you use
db
?ah i use it in
src/lib
there's a lot of api calls in that file, how do i go about moving that to the server and using it in the client?well
if you use a DB there you don't use it on the client
you'd create an API endpoint in nitro and call this one instead π
what are the pros of using nitro as opposed to a custom backend?
e2e typesafety, all in one codebase, easy deployment, same language (JS/TS), fast + modern etc.
you can also still use a third party backend together or without nitro, not a problem
ah, are there any docs on that?
there is https://nitro.unjs.io/
Nitro - Next Generation Server Toolkit
Create web servers with everything you need and deploy them wherever you prefer.
and there is a "server" section in the nuxt docs
thank you