Coder Social home page Coder Social logo

hmjatt / weather-app Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 528 KB

An Application that let's you search weather for a specific location and toggles between Fahrenheit or Celsius. Shows a random Gif according to weather

License: MIT License

JavaScript 44.84% CSS 31.94% HTML 23.22%
async-await dotenv-webpack giphy-api javascript nodejs openweathermap webpack

weather-app's Introduction

Weather-App

This is an image

An Application that let's you search weather for a specific location and toggles between Fahrenheit or Celsius. This project is created to practice topics like JSON, API Keys(Secrets, and Security), Async & Await in JavaScript while using Webpack as a module bundler. App shows a random Gif based on current weather of location, Enjoy!!! πŸ˜ƒ . Feel free to reach me at Twitter

Technologies Used

javascript   html5   css3   json   openweatherapi

webpack   npm

Includes the following features/components:

- Css Loader
- Asset Resource Loader
- Html Webpack Plugin
- Source Maps
- Open Weather API
- Giphy API
- Fetch API
- Async & Await
- Babel Loader
- Webpack
- Dotenv-webpack(NPM Module)

Usage

Run Dev Server (Port 5500)

```
npm install

```

```
npx webpack --watch // Clientside

```

Links to content that helped me with this project

  1. The Odin Project

  2. Design Inspiration

  3. Open Weather API

  4. Webpack

  5. YouTube

  6. Dotenv-webpack(NPM module)

  7. Fetch API

  8. Giphy API

  9. CSS Loader

Notes/Remarks

  • I have secured the API key using environment variables created using Dotenv-webpack(NPM module). This is to prevent someone from abusing the API key. This is a security feature and adds a security layer to app. But API key is still visible in the dev tools. To secure an API properly, you should use a backend like ExpressJS.

  • Fetched weather, specifically Wind Speed sometimes is inaccurate but it's coming from the API and is for educational/entertainment purposes only.

  • Fetched Gif's are based on the weather of location and application fetches a random Gif according to weather fetched.

  • Async & Await is a JavaScript feature that allows us to write asynchronous code in a synchronous manner. It is used to make our code more readable and easier to understand.

  • I have used the Open Weather API to get the weather data. This is a free API that allows you to get the weather data for a specific location(view Documentation for details). This API has 60 requests per minute(1,000,000 requests per month) limit, view pricing information for more details.

  • I have used the Giphy API to get the gifs for the weather. This is a free API that allows you to get the gifs for the weather. This API has 1,000 requests per day limit, view documentation for more details.

  • As stated in the James Q Quick's video, securing an api with environment variables does add a security layer that hides API key. But there are ways around this and during a call to the API, your API key is passed as a query parameter. This means that the API key is visible in the source code in the browser(or POSTMAN).

  • Using environment variables is appropriate for this project because it is a small project(no need to authenticate user for just checking the weather), API key is free and request quota is limited so someone can't abuse it. But if you were to use an API in a larger scale project(where a user needs to log in), you would need to use a more secure method of storing the API key. For example, you could use a database, JWT auth, Bcrypt Package or even a Back-end server as a wrapper as stated in James Q Quick's video to authenticate a user.

Future Changes/Fixes

  • Add a Dashboard

  • Add Maps

Quote

β€œLearning never exhausts the mind.”
β€” Leonardo da Vinci

πŸ“” πŸ–‹οΈ 🀟

weather-app's People

Contributors

hmjatt avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.