Code Monkey home page Code Monkey logo

openweathermap's Introduction

Get Weather powered by Laravel

Installation

# clone the repo
$ git clone [email protected]:HilalLko/openweathermap.git get-weather

# go into app's directory
$ cd get-weather

# install app's dependencies
$ composer install

# install app's dependencies
$ npm install

Configure you env

If you choice to use MySQL

Copy file ".env.example", and change its name to ".env". Then in file ".env" complete this database configuration:

  • DB_CONNECTION=mysql
  • DB_HOST=127.0.0.1
  • DB_PORT=3306
  • DB_DATABASE=laravel
  • DB_USERNAME=root
  • DB_PASSWORD=

Set APP_URL

If your project url looks like: example.com/sub-folder Then go to get-weather/.env And modify this line:

  • APP_URL =

To make it look like this:

Next step

# in your app directory
# generate laravel APP_KEY
$ php artisan key:generate

# run database migration and seed
$ php artisan migrate:refresh --seed

Next step (Add Weather Map API Keys)

Add API key and desired language in `.env`

OPENWAETHER_API_KEY=
OPENWAETHER_API_LANG=en

Usage

# start local server
$ php artisan serve

# test
$ php vendor/bin/phpunit

To get List of All Available Cities

{BASE_URL}/api/cities

Sample Output


To get Current Weather Forecast

{BASE_URL}/api/city/weather/current/{city}

Sample Output


To get Previous Weather History (5days) Forecast

{BASE_URL}/api/city/weather/history/{city}

Sample Output


To get Future (4 days) Weather Forecast

{BASE_URL}/api/city/weather/future/{city}

Sample Output


Some future are intended to only authenticated user

To get authenticated/login

{BASE_URL}/api/login

Sample Output


To add a new city

{BASE_URL}/api/city/add

Sample Request Header


Sample Output


openweathermap's People

Contributors

hilallko 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.