Files
lara-bermite/routes/api.php
2024-03-09 15:34:30 +01:00

39 lines
1.7 KiB
PHP

<?php
use App\Http\Controllers\AuthController;
use App\Http\Controllers\LocationController;
use App\Http\Controllers\RainfallController;
use App\Http\Controllers\WeatherController;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "api" middleware group. Make something great!
|
*/
Route::post('/login', [AuthController::class, 'login'])->name('login');
Route::post('/forgot', [AuthController::class, 'forgot'])->name('forgot');
Route::post('/register', [AuthController::class, 'register'])->name('register');
Route::post('/reset', [AuthController::class, 'reset'])->name('reset');
Route::middleware('auth:sanctum')->group(function () {
Route::get('/user', [AuthController::class, 'user'])->name('user');
Route::delete('/logout', [AuthController::class, 'logout'])->name('logout');
Route::post('/locations', [LocationController::class, 'store'])->name('location.store');
Route::get('/rainfalls/last-months', [RainfallController::class, 'lastMonths'])->name('rainfalls.last-months');
Route::get('/rainfalls/last', [RainfallController::class, 'lastRainfalls'])->name('rainfalls.last');
Route::get('/rainfalls/graph', [RainfallController::class, 'graphValue'])->name('rainfalls.graph');
Route::apiResource('rainfalls', RainfallController::class);
Route::get('weather', [WeatherController::class, 'index'])->name('weather.index');
});