Git Product home page Git Product logo

weather-app's Introduction

Weather app

Test task to build a small weather app with using Laravel

Installation:

git clone https://github.com/soa4work/weather-app.git
cd weather-app
cp .env.example .env
docker-compose up -d
docker-compose exec laravel.test composer install
./vendor/bin/sail up

Get current weather endpoint

  • Url: /api/current/{lang}/
  • Method: GET
  • Params:
    • city: string; required only when longitude and latitude params are empty;
    • longitude number - required only when city param is empty and when latitude is present;
    • latitude: number - required only when city param is empty and when longitude is present;
    • units: string - optional param (standard, metric, imperial) . When you do not use the units params, format is "metric" by default.

Examples:

  • http://localhost/api/current/ru?city=tomsk

response: 200

{
    "description": "пасмурно",
    "temp": 26,
    "pressure": 1012,
    "humidity": 73,
    "wind": {
       "direction": "южный",
       "speed": 2
    }
}
  • http://localhost/api/current/ru?city=unknown

response: 404

{
    "message": "Не найдено."
}
  • http://localhost/api/current/ru?latitude=220&longitude=1

response: 422

{
    "message": "Значение поля latitude должно быть между -90 и 90.",
    "errors": {
        "latitude": [
            "Значение поля latitude должно быть между -90 и 90."
        ]
    }
}

Tests

./vendor/bin/sail up -d && ./vendor/bin/sail test

weather-app's People

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.