ket-c / laravel-vue-weather-app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Laravel-Vue-Weather-App

In order to get the weather api to work, you will need API key from Weather API. Signup to obtain API KEY

Installation

API

  • Navigate to /api folder
  • Ensure version docker installed is active on host
  • Copy .env.example: cp .env.example .env
  • Start docker containers docker compose up (add -d to run detached)
  • Connect to container to run commands: docker exec -it fullstack-challenge-app-1 bash
    • Make sure you are in the /var/www/html path
    • Install php dependencies: composer install
    • Setup app key: php artisan key:generate
    • Migrate database: php artisan migrate
    • Seed database: php artisan db:seed
    • Run tests: php artisan test
    • Run app: php artisan serve
  • Visit api: http://localhost -Run Scheduler : php artisan schedule:work
    • Or you can manually run php artisan weather:refresh
    • Run queue eg. php artisan queue:work --max-time=300

Add these to you .env file, and replace {KEY} with your api key obtained from Weather API

WEATHER_BASE_ENDPOINT= 'https://api.weatherapi.com/v1/'
WEATHER_API_KEY="{KEY}"

Frontend

  • Navigate to /frontend folder
  • Replace http://127.0.0.0:8000 in /src/components/ApiTest.vue with the domain and host of the API
  • Install javascript dependencies: npm install
  • Run frontend: npm run dev
  • Visit frontend: http://localhost:5173

About


Languages

Language:PHP 85.1%Language:Vue 11.6%Language:TypeScript 1.1%Language:Shell 0.8%Language:JavaScript 0.6%Language:Dockerfile 0.5%Language:HTML 0.3%Language:CSS 0.1%