Use of Public files/functions

I see a Public folder in the site navigation bar between Lightboxes and Backend but am unclear how to leverage it. How do functions in Public files interact with functions defined in backend and frontend files? Where does the code in Public functions execute - frontend or backend?

I

Hi, you can use them both in BE and FE, executed accordingly.
Just a simple example. Lets say I have ‘utils.js’ under ‘public’. It looks like that:

export function sayHelloTo(name) {
    return `Hello ${name}!`;
}

Then, in FE or BE use I’ll use it that way:

import {sayHelloTo} from 'public/utils'

someButtonOnClick() {
    console.log(sayHelloTo('sdvisconti')); //logs Hello sdviconti!
}

Hope this helps clarify.
Liran.

Is it possible to create a hyperlink externally to a non-JavaScript file in the public folder? E.g., if you wanted to share a small file publicly with your customers?

Hey Liran, can you tell us, where the code is going to be executed? I understand, that you can use the public code in backend and in frontend, but where is the code stored? If I call a function from the public folder, is it called from the server or does it run on the client side?