Giter Site home page Giter Site logo

newweatherapi's Introduction

weather

The Project

This project was one of my first coding challenges after taking up a position after graduating from university. The task was to read some json from an api, map it to a pojo and display that pojo back to the user. This task allowed me to discover technologies I have never experienced before such as Dropwizard, Maven, Json and ... eventually MongoDB.

Dropwizard comes packaged with helpful libraries such as Jackson which I use to map json data to my POJO. My first task was understanding how this was done. Jackson binds keywords to the pojo, so I knew my varaiable names needed to match .. can be different but makes it easier to read. Further more, the Json I was mapping was nested with different objects within. This meant that I had to create a pojo for each of these, and include one final pojo which wraps all these pojos together.

Once this was completed and the pojo was displayed back to the user, my next challenge was to write this to a mongoDB and cache the data. Mongo was not something I have had experience with before, and was interesting to see how it handles compared to something like MySQL or PostgreSQL. To cache the data, we simply wanted to call the api, and if the time between calling the api was grater than an hour, then we should update the record in Mongo ... if it existed in the first place.

Overall, this exercise was a great way to explore the technologies currently being used in my place of work. The final stage of this was to Dockerise the project. However, this has not been acheive as of yet due to time constraints on my end.

How to start the weather application

  1. Run mvn clean install to build your application
  2. Start application with java -jar target/new-weather-1.0-SNAPSHOT.jar server config.yml
  3. To check that your application is running enter url http://localhost:8080

Health Check

To see your applications health enter url http://localhost:8081/healthcheck

newweatherapi's People

Contributors

alexo-123 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.