Web modules allow you to write backend functions that you can easily call from the frontend.
Warning:
Web modules defined using .jsw files are deprecated and you will soon be unable to create new .jsw files. However, existing .jsw web modules will continue work as expected. Switch to web module defined using .web.js files for your current and future projects.
The following describes how to create, export, and call web module functions.
Add an exported function to an existing .jsw file.
Set permissions for each function in the web module if necessary. The default permission is Anyone.
You can set permissions in the Wix Editor or by editing the permissions.json file, depending on your development environment:
To call a web method from the frontend:
Import the exported web method from the web module you created above:
Call the imported function:
Remember, web module functions are always asynchronous.