Read the statement by Michael Teeuw here.
Weather module - creating new Provider
-
Thank you so much for the feedback - very much appreciated!
Your explanation makes a lot of sense and confirms (more clearly) what I’ve been reading in other places. I’ll think a bit about my options, including configuring a proxy to sit in front of the Environment Canada api or even just creating my own module that implements node_helper (although I’d prefer to leverage weather).
-
@crazylegs : would be a good idea to add node_helper in weather module and allow to have configurable option for weather provider to get the data via node helper proxy. Current code will not change much and current providers can also leverage this. If you are going to do this open an issue on GitHub and propose solution or make a pull request.
-
@ashishtank Yes I agree 100%. The optimal solution is likely to push at least some of the fetchData instance function’s responsibility into node_helper. Assuming this can be done without breaking Promise functionality, it should be invisible to current Providers. I’m going to play around with this a bit and then raise an appropriate request on github. Thanks again for your feedback and guidance!
-
you could use a proxy https://cors-anywhere.herokuapp.com/https://dd.weather.gc.ca/citypage_weather/xml/ON/s0000326_e.xmll, there is already such a line in the PullRequest merged today.
-
@karsten13 Thanks for highlighting this! I did a quick-and-dirty test in my code using this proxy and I’m now able to pull back the data from the EnvCanada provider! I will likely need to override the default fetchData function since it expects to JSON.parse the Provider data. This is not quite what I need since EnvCanada just provides an XML document to parse (JSON.parse fails…). But now I can at least start playing around some more.