Git Product home page Git Product logo

weather-now's Introduction

WeatherNow

WeatherNow is an application designed to display the current temperature of cities around the world.

Tools Used in Development

  • Angular CLI - Angular Command Line Interface - version 1.7.4
  • Angular- version 5.2.0
  • TypeScript - version 2.5.3
  • NodeJs- version 8.11.1
  • ng2-cache - Client side caching service for Angular2 - version 0.1.12
  • Protractor, Karma & Jasmine - for tests
  • Open Weather Map - Api to get current weather and forecasts in various cities around the world

Architecture

WeatherNow was made with Angular 5 using Typescript and was developed based on components, with specific functions, based on the principles Clean Code, SOLID and DRY. Component style was created from CSS3 with SCSS.

  • Components:

AppComponent - Responsible for creating the application and displaying the main page - single route created.

TopBar - Component responsible for creating the application header.

CardWeather - Receives as parameter some properties like the name of the city and country and is responsible for the construction and maintenance of the cards displayed on screen.

Checks if the application has cached data, and if it does not, check the service every 10 minutes.

  • Services:

WeatherService - Responsible for consulting the OpenWeatherMap API and returning Weather models with their respective city.

CacheService - Data is being cached in LocalStorage for 10 minutes, from the service CacheService of the ng2-cache package.

  • Models:

City - Class that has the data inherent to City.

Weather - Class that has Weather data.

  • Pages:

Home - Application main page that builds the cards from a list of options.

Development

Getting Started

  • Prerequisites:

This project have dependencies that require Node 6.9.0 or higher, together with NPM 3 or higher.

Prepare the development enviroment by running:

npm install -g @angular/cli

Install app dependencies by running inside app path:

npm i

Development server

Serve app in development mode by running:

ng serve

Then open the address http://localhost:4200/ in the browser. The app will automatically reload if you change any of the source files.

Tests

You can run tests by running:

ng test

To execute the unit tests via Karma.

  • The following unit tests were implemented:

AppComponent:

should create the app

should have as title 'WeatherNow'

CardWeatherComponent:

should create

should not display error

should display error

should display in blue temperatures equal to or less than 5 degrees

should display in orange temperatures above 6 degrees and equal to or below 25

should display in red temperatures above 26 degrees

TopBarComponent:

should create

should render the logo

HomeComponent:

should create

must have a list with options for the cards

WeatherService:

getWeatherByCityName()

should return an Observable<Weather>

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the -prod flag for a production build.

TODO

  • Improve test coverage
  • Implement E2E tests

weather-now's People

Contributors

angular-cli avatar

Watchers

Amanda Wenderroscky 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.