Skip to content

Instantly share code, notes, and snippets.

@fredriccliver
Created September 10, 2020 08:39
Show Gist options
  • Save fredriccliver/a71ed475c6b602492aadbf8c031bd882 to your computer and use it in GitHub Desktop.
Save fredriccliver/a71ed475c6b602492aadbf8c031bd882 to your computer and use it in GitHub Desktop.
let API_ROOT = ""
if (location.hostname == "127.0.0.1" || location.hostname == "localhost") {
API_ROOT = `https://localhost:5001/${firebaseConfig.projectId}/us-central1`
}else{
API_ROOT = `https://us-central1-${firebaseConfig.projectId}.cloudfunctions.net`
}
fetch(API_ROOT+"/api/sentences", {
method: "GET"
}).then((response) => console.log(response.json()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment