Created
March 5, 2019 18:01
-
-
Save grant/fa7a1c76d819b15f90a1c3843a4783d6 to your computer and use it in GitHub Desktop.
CORS + GCF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// server | |
res.header("Access-Control-Allow-Origin", "*"); | |
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); | |
// client | |
var b = fetch('https://us-central1-{project}.cloudfunctions.net/{method}').then((response) => { | |
const a = response.json().then(c => {console.log(c)}); | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment