Created
January 6, 2020 12:01
-
-
Save jineeshjohn/ec00b637bf3e46a036f775a501d7c9b1 to your computer and use it in GitHub Desktop.
How to create a proxy using react create app
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
//step 1: Inside package.json add proxy key | |
// eg: "proxy": "http://jsonplaceholder.typicode.com" | |
//step 2: sample program to retrive from jsonplaceholder | |
(async()=>{ | |
const apiData = await fetch('/users'); | |
const json = await apiData.json(); | |
console.log("JJJ:", json); | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment