Hi there!
I believe this is my first post and while I always try to resolve my problems through searching, this has me totally stumped and quite frustrated!
So here's what the issue is...
I have a nodejs/express app that creates endpoints which send out specific data from MongoDB. I have hosted this on heroku and have npm install cors as well as doen the usual app.use to allow access-control headers.
If I test the end point in a browser, I get the complete json string but if I test in c3, I get a CORS issue. Even when I export the C3 game to html 5 and host it on another server of mine, I get the same issue. The only way I sort of get past it is by using a CORS plugin in my browser (firefox) which then gives me a value of null!
Here's my url to see the API end point GET -> (/getImages)- > guess-the-word-v1.herokuapp.com/getImages
and this is my c3 code
Now when I try this out in a standard chrome browser, I get a CORS error (despite having set -
const cors = require("cors" )
app.use(cors())
Forgetting the above, if I test with the CORS plugin inbrowser, I get the following response ->
That seems to indicate, its not waiting for an asynchronous fetch. How do I set an async event in C3? I thought the AJAX - on "tag" completed would wait for the callback?
Hoping someone can help point me in the right direction!
PS : Next I am going to try the complete js - await fetch in a script... will that work?