Convert Functions & WebMethods Tool V0.1.10
Use at your own risk, always back-up in case of error.
Tool (attempts to...) convert functions (from .jsw) to a webMethod and vice versa;
export async function createCategory(category, options) {
return await categories.createCategory(category, options);
}
converts to;
export const createCategory = webMethod(Permissions.Anyone, async (category, options) => {
return await categories.createCategory(category, options);
});
AI Prompt
This tool does not use AI, but here is a sample prompt, which may aid conversion in more dynamic applications.
In Wix there are two forms of exported function: a function and a webMethod. I will give the structure of both to prime a two way conversion for any new function I give;
```JS
//this is a webMethod import { Permissions, webMethod } from "wix-web-module"; export const myFunction = webMethod(Permissions.Anyone, async ( params ) => { //code here });```
```JS
//this is a function export async function myFunction (params) { //code here }```