<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: CourtneyKerr</title>
    <description>The latest articles on DEV Community by CourtneyKerr (@courtneykerr19).</description>
    <link>https://dev.to/courtneykerr19</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1253870%2Fe4fbc41c-4f04-40eb-b359-57f068c2f14d.jpg</url>
      <title>DEV Community: CourtneyKerr</title>
      <link>https://dev.to/courtneykerr19</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/courtneykerr19"/>
    <language>en</language>
    <item>
      <title>Building a Single Page Weather App with JavaScript</title>
      <dc:creator>CourtneyKerr</dc:creator>
      <pubDate>Fri, 24 Jan 2025 13:33:59 +0000</pubDate>
      <link>https://dev.to/courtneykerr19/building-a-single-page-weather-app-with-javascript-3cde</link>
      <guid>https://dev.to/courtneykerr19/building-a-single-page-weather-app-with-javascript-3cde</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
As part of Flatiron School's Phase-1 Final Project, I was tasked with creating a single-page web application using only HTML, CSS, and JavaScript while also incorporating a public API to fetch and display real-time data dynamically.&lt;/p&gt;

&lt;p&gt;For this project, I decided to build a Weather Application titled "Your Weather Forecast". The goal was to design a responsive and user-friendly application that provides real-time weather updates along with an accurate forecast for any city across the globe. I found this project to be just as rewarding as it was challenging, allowing me to apply the knowledge I gained from Phase-1 of this course by building a personal tool that is simple and practical to work with.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project Requirements:&lt;/strong&gt;&lt;br&gt;
1.) The application must run entirely on a single page—no redirects or reloads allowed—and fetch data from a public API or a local db.json file.&lt;br&gt;
2.) he API must return at least five different objects, each containing at least three unique attributes.&lt;br&gt;
3.) The application must include at least three unique event listeners, each listening for a different type of event and added using the .addEventListener() method.&lt;br&gt;
4.) At least one instance of array iteration must be implemented.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;App Features: *&lt;/em&gt;&lt;br&gt;
1.) Real-Time Weather Updates&lt;br&gt;
When a user enters a city name, the application fetches real-time weather data specific to that location. The page dynamically displays:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Current temperature (in Celsius).&lt;/li&gt;
&lt;li&gt;Humidity and wind speed.&lt;/li&gt;
&lt;li&gt;A weather condition icon (e.g., clouds, sun, rain).&lt;/li&gt;
&lt;li&gt;Geographic coordinates (latitude and longitude).
2.) 5-Time-Point Forecast
In addition to current weather updates, the app provides a 5-time-point weather forecast, showing predictions for the next 15 hours in 3-hour intervals. Each forecast includes:&lt;/li&gt;
&lt;li&gt;Date and time of the forecast.&lt;/li&gt;
&lt;li&gt;Predicted temperature (in Celsius).&lt;/li&gt;
&lt;li&gt;Weather condition.
3.) Dynamic Updates
This Weather Application ensures quality user experience by dynamically fetching and displaying weather data without any refresh or reloads from the page. Any changes in weather information is updated instantly.
4.) Error Handling
This application The app gracefully handles invalid input by displaying an error message if a city cannot be found. Users are also given feedback for any incorrect or empty inputs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How I met the requirements&lt;/strong&gt;&lt;br&gt;
1.) Single Page Application:&lt;br&gt;
The entire application operates on a single page. All interactions—such as searching for a city or viewing the weather forecast—are handled through JavaScript, which dynamically updates the DOM based on user input and API responses.&lt;/p&gt;

&lt;p&gt;2.) Incorporating five different objects each with at least three of their own attributes.&lt;br&gt;
This application incorporates five key objects:&lt;br&gt;
1.) Main Object (Weather Details):&lt;br&gt;
  -Attributes: temp, humidity, pressure&lt;br&gt;
  -Role: Provides real-time weather data, including &lt;br&gt;
   temperature, humidity levels, and atmospheric &lt;br&gt;
   pressure.&lt;br&gt;
2.) Wind Object (Wind Information):&lt;br&gt;
  -Attributes: speed, deg, gust&lt;br&gt;
  -Role: Captures wind speed, direction, and gusts &lt;br&gt;
   for the selected city.&lt;br&gt;
3.) Weather Object (Weather Description):&lt;br&gt;
  -Attributes: main, description, icon&lt;br&gt;
  -Role: Describes the overall weather condition, &lt;br&gt;
   such as "Clear" or "Rain," and includes an icon &lt;br&gt;
   for visual representation.&lt;br&gt;
4.) Custom City Object (cityInfo):&lt;br&gt;
  -Attributes: name, coordinates, timezone&lt;br&gt;
  -Role: Represents the city information, including &lt;br&gt;
   its name, geographic coordinates, and timezone &lt;br&gt;
   offset.&lt;/p&gt;

&lt;p&gt;5.) Forecast Object (Each Entry in data.list):&lt;br&gt;
  -Attributes: date, temperature, condition&lt;br&gt;
  -Role: Displays detailed 3-hourly weather &lt;br&gt;
   forecasts for the next 15 hours, retrieved from &lt;br&gt;
   the API.&lt;/p&gt;

&lt;p&gt;3.) Three unique Event Listeners.&lt;br&gt;
The app uses three distinct event listeners, each with its own callback function:&lt;br&gt;
   -Search Button Click: Fetches weather data &lt;br&gt;
   when the "Search" button is clicked.&lt;br&gt;
   -"Enter" Keypress: Triggers the search &lt;br&gt;
   functionality when the "Enter" key is pressed.&lt;br&gt;
   -Input Event: Dynamically updates a city preview &lt;br&gt;
   as the user types in the search field.&lt;/p&gt;

&lt;p&gt;4.) At least one instance of Array Iteration.&lt;br&gt;
The forecast section uses the .map() method to iterate over the data.list array from the OpenWeatherMap API and extract forecast data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Challenges and Solutions&lt;/strong&gt;&lt;br&gt;
1.) Handling APIs&lt;br&gt;
Understanding how to fetch data asynchronously and handle API responses was initially challenging. By carefully reading the OpenWeatherMap documentation and practicing with fetch and async/await, I gained confidence in working with APIs.&lt;/p&gt;

&lt;p&gt;2.) Styling&lt;br&gt;
CSS has always been a weak spot for me. However, this project pushed me to focus on creating a visually appealing interface, resulting in a design that is both functional and attractive.&lt;/p&gt;

&lt;p&gt;3.) Error Handling&lt;br&gt;
Implementing robust error handling was another challenge. I ensured that the app could gracefully handle invalid city names or empty inputs, enhancing the user experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
This project has given me confidence in using techniques such as asynchronous programming, handling APIs, and responsive design. This Weather Application has allowed me to put to use all the lessons and skills I've learned throughout Phase-1.&lt;/p&gt;

&lt;p&gt;If you'd like to explore the code or provide feedback, feel free to check out the repository:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/CourtneyKerr19/Your_Weather_Forecast" rel="noopener noreferrer"&gt;https://github.com/CourtneyKerr19/Your_Weather_Forecast&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Building a Single Page Weather Application in JavaScript</title>
      <dc:creator>CourtneyKerr</dc:creator>
      <pubDate>Tue, 26 Nov 2024 20:57:45 +0000</pubDate>
      <link>https://dev.to/courtneykerr19/building-a-single-page-weather-application-in-javascript-ca6</link>
      <guid>https://dev.to/courtneykerr19/building-a-single-page-weather-application-in-javascript-ca6</guid>
      <description>&lt;p&gt;Introduction&lt;br&gt;
To finally close off Phase-1 of Flatiron School's Software Engineering curriculum, we were assigned to create a single-page web application using only HTML, CSS, and JavaScript, as well as incorporating a public API that would provide the data for our webpage.&lt;/p&gt;

&lt;p&gt;For my project, I decided to create my own weather app titled, 'Today's Weather Forecast'. While the project itself was admittedly a bit basic, it was a fun challenge to take on. The goal was to build a user-friendly, responsive application that provided real-time weather updates and a detailed forecast for any city in the world.&lt;/p&gt;

&lt;p&gt;Project Requirements&lt;br&gt;
The project came with several requirements, each reinforcing fundamental concepts and lessons that were taught throughout Phase-1:&lt;/p&gt;

&lt;p&gt;The application must run entirely on a single page. No redirects or reloads are allowed, and data must come from a public API or a db.json file.&lt;br&gt;
The API or db.json file must return at least five different objects, each containing at least three attributes.&lt;br&gt;
All client and API interactions should be handled asynchronously, using JSON as the communication format.&lt;br&gt;
The project must use at least three unique event listeners, each listening for a different type of event, added using the addEventListener() method. Each event listener must have its own unique callback.&lt;br&gt;
The application must implement at least one instance of array iteration.&lt;/p&gt;

&lt;p&gt;I personally found the implementation on the API to be the most challenging, partially due to my own indecisiveness but also because the concept just felt the most foreign to me. After some exploring however, I found that API implementation was actually one of the easier aspects of this project.&lt;/p&gt;

&lt;p&gt;Features of 'Today's Weather Forecast':&lt;/p&gt;

&lt;p&gt;Real-Time Weather Updates&lt;br&gt;
When the user enters a city name, the application will return real-time weather data specific to that location. The front page will display the current temperature in celsius, a brief weather description, and an icon to visually represent the forecast.&lt;/p&gt;

&lt;p&gt;3-Hourly Forecast:&lt;br&gt;
The application also provides a 24-hour forecast in 3-hour intervals. This section displays to the user both the current time of day and the predicted temperature in celsius. &lt;/p&gt;

&lt;p&gt;Dynamic Updates:&lt;br&gt;
All data is dynamically fetched and displayed without reloading the page, ensuring a seamless user experience.&lt;/p&gt;

&lt;p&gt;How I Met the Requirements&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Single Page Application&lt;br&gt;
This weather application operates entirely on a single page. When a user searches for a city, JavaScript fetches the required data, clears the old content, and dynamically updates the page with the new information—all without redirects or reloads.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Five Objects with Attributes&lt;br&gt;
The following objects were implemented:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;1.) City Object: &lt;br&gt;
    Attributes: Includes name, latitude, and longitude.&lt;/p&gt;

&lt;p&gt;2.) Weather Object: &lt;br&gt;
    Attributes: Includes temperature, description, and icon.&lt;/p&gt;

&lt;p&gt;3.) Forecast Object: &lt;br&gt;
    Attributes: Includes time, temperature, and icon.&lt;/p&gt;

&lt;p&gt;4.) DateTime Object: &lt;br&gt;
    Attributes: Includes date, time, and day.&lt;/p&gt;

&lt;p&gt;5.) DOM Element Object: &lt;br&gt;
    Attributes: Includes id, type, and content.&lt;/p&gt;

&lt;p&gt;Each object played a role in structuring the data and ensuring modularity.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Asynchronous API Handling&lt;br&gt;
Using the fetch API, the app retrieves real-time weather and forecast data from the OpenWeather API. All data interactions use JSON, meeting the project requirements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Three Unique Event Listeners&lt;br&gt;
The app incorporates three distinct event listeners:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Click Event: When users click the "Search" button, it fetches weather data.&lt;br&gt;
Keypress Event: When the "Enter" key is pressed in the input field, it triggers the same weather-fetching functionality.&lt;br&gt;
Mouseover Event: When the user hovers over the weather icon, additional information (e.g., "Data provided by OpenWeatherMap") is displayed dynamically. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Array Iteration
The forecast section uses the forEach method to dynamically create HTML elements for each 3-hour forecast.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Challenges and Solutions&lt;br&gt;
Some challenges I encountered during this project was understanding how to handle asynchronous operations while fetching data from the OpenWeather API, as well as understanding the API in itself and how it differs from a db.json file. &lt;br&gt;
Styling the app was another big challenge for me as CSS has been a weak spot I tend not to focus on in favor of dealing with more daunting and technical concepts.&lt;br&gt;
With practice, however, these concepts didn't seem as monstrous and while I know my code is far from perfect, I feel a lot more confident in my skills as a developer after tackling these challenges. &lt;/p&gt;

&lt;p&gt;Conclusion&lt;br&gt;
This project not only solidified my understanding of JavaScript but also taught me valuable lessons about perseverance, problem-solving, and the importance of clean, modular code.&lt;/p&gt;

&lt;p&gt;I hope you enjoy exploring the application as much as I enjoyed building it. Feel free to share your feedback or suggestions for improvement—I’d love to hear your thoughts!&lt;/p&gt;

&lt;p&gt;If you'd like to take a look at the source code for this project, you can access it in this repository: &lt;a href="https://github.com/CourtneyKerr19/Todays_Weather_Forecast" rel="noopener noreferrer"&gt;https://github.com/CourtneyKerr19/Todays_Weather_Forecast&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you for reading! &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
