Read the statement by Michael Teeuw here.
New to building modules. plz help
-
well, that link works, so the data comes back, THEN you have to DO something with it
because this is in the module, you will have to use the developers window
npm start dev
or
npm start
ctrl-shift-i on the keyboardthen
there are two tabs on the dev window
console where messages are displayed (like console.log and Log.log from the code in the original post)
and the sources tab, where you can step thru the code, line by line as it executes
once on the sources tab, you have to find you code in the left nav tree, expand modules, …etc…to put a stop in the code, on the line
var urlApi =
click the number in the left side of the dev display, it will turn blue, meaning active stop.
hit f5, refresh, and the page will reload and it will stop there, and u can examine the code and data
and step ( the top half of an o shape), or right arrow, continue til next stop, if any -
@sdetweil I used this link https://stats.foldingathome.org/api/donor/Apia_Okorafor but after I replaced that link it doesn’t work.
-
yeh, there is some difficult cors (cross site scripting security) problem
-
@Djninja926 to get the api request to work, I had to add a proxy handler
var urlApi = "https://stats.foldingathome.org/api/donor/Apia_Okorafor"; var proxyUrl = 'https://cors-anywhere.herokuapp.com/' fetch(proxyUrl+urlApi,
-
@sdetweil where do I add the code
var urlApi = "https://stats.foldingathome.org/api/donor/Apia_Okorafor"; var proxyUrl = 'https://cors-anywhere.herokuapp.com/' fetch(proxyUrl+urlApi,
-
@Djninja926 sorry, I was trying different things, forgot that I changed the request function,
back to the original sourcevar urlApi = "https://stats.foldingathome.org/api/donor/Apia_Okorafor" var proxyUrl = 'https://cors-anywhere.herokuapp.com/' // added var retry = true; var dataRequest = new XMLHttpRequest(); dataRequest.open("GET", proxyUrl+urlApi, true); // changed
-
@sdetweil I did all that and this was the output
I think It is working so what do i do know. -
@Djninja926 figure out the data differences from the 1st api used to the new one, and how you have to fix the output format
-
@sdetweil I dont get what you mean
-
@Djninja926 the code u changed had some expected data format back from the service it called.
it used that data format in the code to make the visual part of the outputthe new api (that url ) provides data in a different format.
as an example of the type of thing I am talking about,
1 has a spreadsheet with 4 columns, and 1 has a spreadsheet with 8 columns and none of the column names are the same.
the code expected to find 4 columns with specific names. they aren’t therehow do you reconcile that?
=====> but these apis return json data not excel spreadsheets, it is just an example of the work you need to do