Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimpleWeatherApp

A simple ASP.NET Core MVC application that fetches weather data from OpenWeatherMap API.

Note: Currently, the API returns raw responses or deserialized JSON directly from the service. HTML view rendering is planned for future implementation.


Features

  • Fetch weather data in JSON or XML format.
  • View raw API responses.
  • Deserialized weather info is available via the service (no controller/view yet; HTML rendering planned for future).

Prerequisites


Getting Started

  1. Clone the repository
git clone https://github.com/<YOUR_GITHUB_USERNAME>/SimpleWeatherApp.git
cd SimpleWeatherApp
  1. Set your API key

Open appsettings.json and replace the placeholder with your OpenWeatherMap API key:

{
  "WeatherApiOptions": {
    "ApiKey": "<YOUR API KEY HERE>"
  }
}
  1. Restore packages
dotnet restore
  1. Run the application
dotnet run

By default, the application will run at:

https://localhost:7152
http://localhost:5000

Usage

1. Deserialized Weather (via Service)

You can call the service directly in your code:

var weather = await weatherService.GetWeatherAsync("Manila", "json");

Currently, no controller returns the deserialized object. HTML view rendering is planned for future implementation.

2. Raw API Responses

You can access raw API responses through the existing controller:

  • JSON: /weather?city=Manila&format=json
  • XML: /weather?city=Manila&format=xml

Notes

  • Strategy pattern selects the appropriate deserializer for JSON or XML.
  • HttpClientFactory is used for efficient HTTP requests.
  • Logging via ILogger tracks API calls and errors.
  • HTML view rendering is planned for future implementation; currently, deserialized data is only available in the service layer.

License

This project is licensed under the MIT License.

About

A simple ASP.NET Core MVC application that fetches weather data from OpenWeatherMap API.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages