Local Weather Forecast in SPFx

πŸš€ This article has moved!

Please visit the updated version here:

πŸ‘‰ Go to Updated Article

Sharing is caring!

If you have any questions, feel free to let me know in the comments section.
Happy coding!!!

6 thoughts on “Local Weather Forecast in SPFx

  1. Hi,

    I am new to sharepoint framework and came across your blog while exploring about the SPFx.

    So this webpart seems to be very interesting and i tried to set up it in my local dev.

    Here i have tried couple of changes while playing around with this webpart.

    I tried to call https://ipgeolocationapi.com/ (https://api.ipgeolocationapi.com/geolocate) which is another API to identify the IP address which seems to be free.

    But I am getting below error:

    Access to fetch at ‘https://api.ipgeolocationapi.com/geolocate’ from origin ‘https://tryfinally-app8df77666989e48db880a9bb85d690abe.sharepoint.com’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled

    So to encounter this issue I wrapped this with https://cors-anywhere.herokuapp.com/

    This seems to be working fine but as it hits the above URL so it is picking the address of machine which is hosted this end point which is not correct.

    So I am not sure how we encounter this, any guidance will be really helpful.

    Regards
    Anand

    Like

Comments