Where to put server side helper functions
Answered
Japanese jack mackerel posted this in #help-forum
Japanese jack mackerelOP
Where do i put a file thats intended solely to be called on the backend side for helper functions?
6 Replies
Japanese jack mackerelOP
as in i have a areaOfSquare function that id like to call. its not a component and should never be called directly by the front end
@Japanese jack mackerel Where do i put a file thats intended solely to be called on the backend side for helper functions?
every file is serversided default
Answer
"use client" at the top transforms it into clientside
so if u create a file named -> helper.ts this will be available securely on the server
If u want to go a extra step more secure, i would suggest importing server-only at the top to make sure not to accidentally expose something on the client