I'm starting to move my local project to an online host. I noticed a weird behaviour.If my base URL is localhost:3000, this would work well!axios.get("/").then( (resp)=> console.log(resp)); app.get("/", cors(), (req, res, next) => { //Data would be fetched, and GET would appear in my terminal. console.log("GET"); }); But if my base URL is my hosting site, eg: "https://hostme/site.json"axios.get("https://hostme/site.json").then( (resp)=> console.log(resp)); app.get("/", cors(), (req, res, next) => { //Data would be fetched, but GET would not appear in my terminal. console.log("GET"); }); It looks like axios is able to retrieve the JSON data, but the it wouldn't trigger app.get() in express. Why is that?
Submitted May 21, 2020 at 02:00AM by badboyzpwns
No comments:
Post a Comment