Currency Api Dashboard

TypeScript

Modern currency exchange rate dashboard with real-time market data, conversion tools, analytics, historical trends, and responsive admin interface.

Stars
18
Forks
1
Downloads
N/A
Open Issues
0
Files main

Repository Files

Loading file structure...
routes/web.php
<?php

use App\Http\Controllers\DashboardController;
use App\Models\Currency;
use Illuminate\Support\Facades\Route;

Route::get('/', function () {
    $currencies = Currency::where('active', true)->get();

    return inertia('welcome', [
        'currencies' => $currencies,
    ]);
})->name('home');
Route::inertia('/terms', 'terms')->name('terms');
Route::inertia('/license', 'license')->name('license');
Route::view('/docs', 'docs')->name('docs');

Route::get('/openapi.json', function () {
    $raw = file_get_contents(public_path('openapi.base.json'));

    // Replace all hardcoded localhost references with the current app URL
    $raw = str_replace('http://localhost:8000', url('/'), $raw);

    $spec = json_decode($raw, true);

    // Override the servers array with the current environment URL
    $spec['servers'] = [
        [
            'url' => url('/'),
            'description' => app()->environment('production') ? 'Production Server' : 'Development Server',
        ],
    ];

    return response()->json($spec)
        ->header('Cache-Control', 'no-store, no-cache');
})->name('openapi');

Route::middleware(['auth', 'verified'])->group(function () {
    Route::get('dashboard', [DashboardController::class, 'index'])->name('dashboard');
    Route::get('dashboard/tokens', [DashboardController::class, 'tokensPage'])->name('dashboard.tokens');
    Route::get('dashboard/currencies', [DashboardController::class, 'currenciesPage'])->name('dashboard.currencies');
    Route::get('dashboard/converter', [DashboardController::class, 'converterPage'])->name('dashboard.converter');

    Route::post('tokens', [DashboardController::class, 'storeToken'])->name('tokens.store');
    Route::post('tokens/{id}/regenerate', [DashboardController::class, 'regenerateToken'])->name('tokens.regenerate');
    Route::patch('tokens/{id}/toggle', [DashboardController::class, 'toggleTokenStatus'])->name('tokens.toggle');
    Route::delete('tokens/{id}', [DashboardController::class, 'destroyToken'])->name('tokens.destroy');
});

require __DIR__.'/settings.php';