Is there a way to connect directly to Salesforce’s REST API directly from JS?
CORS is a W3C recommendation that enables Web browsers to request
resources from origins other than their own (cross-origin requests).
For example, using CORS, a JavaScript script at
https://www.example.com could request a resource from
https://www.salesforce.com.