Clarification on instructions for backend Code in Wix

  1. I’m trying to integrate backend code into a Wix site. Im not too picky about how I want to do this, or what language to write in (ideally, I have a locally-hosted Java code that I’d love to simply call). I wouldn’t mind re-writing it in JavaScript though, or another language. But before I decide that I’m confused about my options. I can code but I’m new to the concepts like modules, APIs, & servers.

  2. According to my research, back-end code with Wix is supposed to be easy (or at least do-able and not THAT complicated)…

  3. From this webpage https://support.wix.com/en/article/corvid-calling-server-side-code-from-the-front-end-with-web-modules ,

  4. “Web modules are exclusive to Corvid and enable you to write functions that run server-side in the backend, and easily call them in your client-side code. With web modules you can import functions from backend into files or scripts in public, knowing they will run server-side. Corvid handles all the client-server communication required to enable this access.”

  5. And from this: https://www.sitepoint.com/what-is-wix-code/

  6. “It’s serverless: All this added functionality comes in a serverless environment that lets you get your work done without any of the normal full-stack development headaches. Just code and go: Wix Code has a built-in, online IDE and backend so you can just add the code you need to your page or your site, publish, and you’re live.”

  7. So, I thought they have a backend IDE where I can write backend code directly, or I could call my Java program. But, as I tried doing this and finding tutorials, it seems I can really only do this by calling a public API from the backend…?

  8. https://youtu.be/tuu0D1izrUU

  9. But ive also read (and someone who supposedly has done it before told me this) that Wix integrates with node.js, which is a backend version of JavaScript.

  10. Can I use a Wix domain for a NodeJS app?

  11. But, when I go into my Wix site ( keighley removals ) I cannot find any option for using Node JS, and doing research on that gives me no useful results.

  12. So, I’m thoroughly confused on what the capabilities are here. Can someone help me make sense of this?

  13. Why are there no tutorials showing explicit code in the Corvid backend module? What’s stopping me from simply writing my Java program there in a module? Do I really need an API endpoint to call and pass to the front end?

  14. Is Node JS supported or not - has anyone done this before?

  15. Also, in one link above they said everything is “serverless”. But if I have to set up my own API endpoint won’t I need to set up my own server??

https://support.wix.com/en/article/corvid-managing-external-code-libraries-with-the-package-manager

https://www.wix.com/corvid/reference/wix-fetch.html
https://support.wix.com/en/article/corvid-accessing-third-party-services-with-the-fetch-api
https://support.wix.com/en/article/corvid-web-modules-calling-server-side-code-from-the-front-end

https://www.wix.com/corvid/reference/wix-http-functions.html
https://support.wix.com/en/article/corvid-exposing-a-site-api-with-http-functions

You won’t be able to run your Java program with the Wix platform. Depending on the size of that program, it might make sense to adapt it to expose an API over HTTP and host that on another platform, which you could then call from Wix. You seem to understand this but are reluctant to do it.

Depending on what the program does, you can rewrite it in JS and run that from Wix’s backend without calling any other API over HTTP. Maybe there is a gap in the documentation where it’s not explained where the backend actually is.

Wix does integrate Node into its technology stack but what is exposed to us as programmers is not pure Node. You can run JS only on Wix’s terms: there’s no file system access for instance. Node’s default classes are AFAIK also not exposed. You are supposed to use Wix’s own API and the npm packages they decide to add the library.

You can invoke your backend code from the frontend or schedule jobs to run periodically, but there is no option to have a process running constantly (though you can expose your own HTTP endpoints also).