I am trying to run below curl command under Home.js
import {fetch} from 'wix-fetch';
$w.onReady(function () {
createDO();
});
export function createDO(){
var DO_URL = "<digital-Ocean-api-url>";
var TOKEN = "b0634403bb90aec6c51e3af4a8865";
curl -X GET "<digital-Ocean-api-url>/droplets" \
-H "Authorization: Bearer $TOKEN";
}
And I'm getting below error while running.. Not sure what's the issue
Velo does not have a curl statement. You should use wix-fetch for interfacing with external services. See the article Velo: Accessing 3rd-Party Services with the Fetch API for more information. Note that it is best to put this kind of code in the backend.