Question:
As per instructions I created and published a Velo backend function to handle a GET request. I ran the code in the editor and it worked. After publishing the website the following URLs didn’t work.
In the backend editor I did not see Exposing an API button. Why is that?
So I could not do the following:
- Click on the Exposing an API button.
- Select the function you want to expose and click on the Create Endpoint button.
- The endpoint URL will be displayed in the Endpoint URL field.
I tried the URL:
https://www.wallmirror.com/_functions/get_helloworld
following this pattern:
https://www.{user_domain}/_functions/
Product:
Velo Backend Functions
Here’s the code:
import {ok, notFound, serverError} from ‘wix-http-functions’;
export function get_helloworld() {
let options = {
“headers”: {
“Content-Type”: “application/json”
},
“statusCode”: 200,
“body”: {}
};
options.body = {
“message”: “Hello, World!”
};
return ok(options);
}