How could I change text on the page from the backend using Velo by Wix? Is this possible? I want to do this since I want to display confidential information about the current user, and I don't want to give the frontend access to a function that would return that info so I could do it from the frontend. Thanks in advance!
Wix uses .jsw files to handle front-end calls to the backend. The functions are called by the client but performed by the server
As a very basic example, let's say you want to get a wix-secret from the backend, and display in a text element
page.js:
import {getSecret} from 'backend/test.jsw'
$w.onReady(async () => $w("#secretText").text = await getSecret())
backend/test.jsw:
import wixSecretsBackend from 'wix-secrets-backend';
export function getSecret() {
wixSecretsBackend.getSecret("secretName")
}