This was a project to experiment with the JavaScript fetch()
API and asynchronous functions.
The app is kept simple as it is just experimentation. But we have following use case:
- Type the name of a location in the search bar.
- Click the search button.
- The location name is inserted into a template string (
${}
), for which a HTTP request is made using thefetch()
API. - This returns a promise which is consumed by passing the relevant information retrieved from the HTTP response object into a factory function, returning a hash.
- The hash is then passed into the JSDOM and the infomation is displayed into the relevant DOM elements.
- Finally, a new query in the search bar re-renders the entire page based on the new query.