Should I use "use server" directive for database queries
If I remove the directive, it would still be running on server and everything is safe, right?
1 Reply
yes, you should ever use
"use server"
only if you need to call that function (or functions from a module) from the client side directly, as "use server"
means you're exposing all of this to the world as a public API to the whole world
you don't add "use server"
if you're calling those function from server components, since all of that remains in you server by design