What if scripts added in public folder could be exposed as API’s?
Let me elaborate on my thoughts. A lot of coding issues will end up in talking to WIX from other systems in the future. One way to make this happen without that much of a deal (I guess, don’t have a clue) would be to expose Javascript files under the public folder.
If I create a file called api.news.js the system will automatically handle that because it has the api. in the filename. After saving this file I have a new endpoint on my site reachable from:
I could then post stuff to that address and get the contents using…
let jsonBody = json_decode("wix://input");
That code would get all posted into a JSON decoded string and then I can insert that into collections, work with it in anyway using WIX code and return what ever I need to return.
This way I can expose how many API’s I wan’t by just adding files, I don’t have to expose my whole Data Collections or in anyway do anything else.
Add a file in a certain naming convention and then rock n roll.