DEV Community

smm7530
smm7530

Posted on

Lab 3 -- Option 1

Wikipedia query tag

The tag is Wikipedia query tag. If you type <wikipedia-query search="whatever you want to search"></wikipedia-query>, it will post a Wikipedia article with the world you typed. After add the dependency by npm i @lrnwebcomponents/wikipedia-query, it will appear on the package.json. image

GeoIP API

In locationFromIP.js, it fetched this.locationEndpoint (the API is not working). It suppose to provide longitude and latitude. Image description

IP Fast API

Similarly, in UserIP.js, the API is used to determine the city and country.
Image description

Image description
Image description

Together

After we successfully fetched the location endpoint and user IP, we then read the data with json() and pull the information we need (longitude, latitude, city and state )
Image description

Display the code

I added a link that shows the map of my location and Wikipedia articles about my city and state.
Image description

GitHub

This is a link to my GitHub. The file is under src --> LocationFromIP.js (GeoIP API) & UserIP.js (IP Fast API). Please feel free to leave command on both my GitHub and this blog as I'm totally new to these concepts and can be wrong!

Top comments (0)