Table of Contents
- Create a service, which returns product recommendations depending on the weather forecast;
- Use GIT properly - just like you will do in production;
- Store your product data in the database;
- Service should be realized using REST API principles. Request and response should be handled in JSON format;
- Integrate third-party API to get the current weather information in any Lithuania city. We recommend using the LHMT API: https://api.meteo.lt/ . (Note, that this API requires you to inform the user about the source of the data, which is LHMT).
- Use cache for all requests (for 5 min.).
- It should use the most occurring weather type;
- Host it somewhere (e.g. Heroku, Google) or provide us with the ability to launch your app (include the command that would start it, bonus if you include docker-compose.yml);
- Fill the README.md file as you would do for a production application. Include challenge description, used technologies, setup guide and usage examples.
- PHP 7+ version;
- MySQL;
- Laravel framework;
- Tailwindcss;
- alpine js;
Please check the official laravel installation guide for server requirements before you start. Official Documentation
Click on Config -> Apache (httpd.conf) Or you can find the file here
C:\XAMPP\apache\conf\httpd.conf
Change the line
Listen 80
To 8666 or other free port
( accordingly you will need to change http://adeoweather.com:8666
to http://adeoweather.com:{your chosen numbers}
in file app\Htpp\Controllers\view\ProductViewController
submit
method, located at the end of the file )
Listen 8666
Open httpd-vhosts.conf
file located in C:\XAMPP\apache\conf\extra\httpd-vhosts.conf
and add
<VirtualHost *:8666>
DocumentRoot "C:/xampp/htdocs/join_Matas_Bendikas/laravel/public"
ServerName adeoWeather.cpm
ServerAlias www.adeoWeather.com
ErrorLog "logs/adeoWeather.log"
CustomLog "logs/custom.adeoWeather.log" combined
<Directory "C:/xampp/htdocs/join_Matas_Bendikas/laravel/public">
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Find vhost
file in C:\Windows\System32\drivers\etc
and add
127.0.0.1 adeoWeather.com
Start/Re-start your Apache and MySQL again
-
Clone the repo in
C:\XAMPP\htdocs\
git clone https://github.com/joinAdeoWeb/join_Matas_Bendikas.git
-
Switch to the repo folder
cd join_Matas_Bendikas/laravel
-
Install all the dependencies using composer
composer install
-
Copy the example env file and make the required configuration changes in the .env file
cp .env.example .env
-
Generate a new application key
php artisan key:generate
-
Run the database migrations (Set the database connection in .env before migrating)
php artisan migrate
-
Install packages for alpine js./tailwindcss
npm install
TL;DR command list
git clone https://github.com/joinAdeoWeb/join_Matas_Bendikas.git
cd join_Matas_Bendikas/laravel
composer install
cp .env.example .env
php artisan key:generate
php artisan migrate
npm install
1 Pav. Sistemos adeoWeather "Wardrobe" langas
2 Pav. Sistemos adeoWeather "product" langas
3 Pav. Sistemos adeoWeather "edit product" langas
4 Pav. Sistemos adeoWeather "create product" langas
5 Pav. Sistemos adeoWeather "What to wear" langas
6 Pav. Sistemos adeoWeather "What to wear" langas kai pateikas miestas
Returns product list
https://adeoweather.com:8666/api/products
{
"data": [
{
"sku": "UM-3",
"name": "Kepurė",
"price": "10.99",
"for_weather_forecasts": "sunny,rainy"
},
{
"sku": "UM-17",
"name": "Paltas",
"price": "100.00",
"for_weather_forecasts": "sleet,windy"
},
{
"sku": "UM-18",
"name": "Šalikas",
"price": "5.00",
"for_weather_forecasts": "sleet"
}
]
}
Returns product by id(sku)
https://adeoweather.com:8666/api/products/3
{
"data": {
"sku": "UM-3",
"name": "Kepurė",
"price": "10.99",
"for_weather_forecasts": "sunny,rainy"
}
}
Create new product listing
https://adeoweather.com:8666/api/products
{
"name": "Lietpaltis",
"price": 30.00,
"for_weather_forecasts": "rainy"
}
{
"data": {
"sku": "UM-20",
"name": "Lietpaltis",
"price": 30,
"for_weather_forecasts": "rainy"
}
}
Update product
https://adeoweather.com:8666/api/products/3
{
"data": {
"sku": "UM-3",
"name": "Kepurė",
"price": "10.99",
"for_weather_forecasts": "sunny,rainy"
}
}
{
"name": "Kepurė su pašiltinimu",
"price": "15.99",
"for_weather_forecasts": "sunny,rainy"
}
status code: 200 OK
GET https://adeoweather.com:8666/api/products/3
{
"data": {
"sku": "UM-3",
"name": "Kepurė su pašiltinimu",
"price": "15.99",
"for_weather_forecasts": "sunny,rainy"
}
}
Delete product by id(sku)
https://adeoweather.com:8666/api/products/20
{
"data": {
"success": true
}
}
Get product recommendations by weather forecast for 3 days including current one. It may return from 0 to 2 products, depending on products added to your wardrobe.
adeoweather.com:8666/api/products/recommended/vilnius
{
"city": "Vilnius",
"recommendations": [
{
"weather_forecast": "cloudy",
"date": "2023-01-30",
"products": [
{
"sku": "UM-21",
"name": "Megztinis",
"price": "20.00"
},
{
"sku": "UM-22",
"name": "Striukė",
"price": "50.99"
}
]
},
{
"weather_forecast": "clear",
"date": "2023-01-31",
"products": [
{
"sku": "UM-23",
"name": "Maikė ilgomis rankovėmis",
"price": "15.00"
}
]
},
{
"weather_forecast": "cloudy",
"date": "2023-02-01",
"products": [
{
"sku": "UM-21",
"name": "Megztinis",
"price": "20.00"
},
{
"sku": "UM-22",
"name": "Striukė",
"price": "50.99"
}
]
}
]
}
- Create a service, which returns product recommendations depending on the weather forecast;
- Store your product data in the database;
- Integrate third-party API to get the current weather information in any Lithuania city. We recommend using the LHMT API: https://api.meteo.lt/ . (Note, that this API requires you to inform the user about the source of the data, which is LHMT);
- Use cache for all requests (for 5 min.);
- Host it somewhere (e.g. Heroku, Google) or provide us with the ability to launch your app (include the command that would start it, bonus if you include docker-compose.yml);