produkt

Jan 26th, 2025 04:07 PM

Laravel 11 comes with a health check endpoint at route “/up” that comes standard. I noticed this is not available in the Wave app. How can this be made available in my project?

bobbyiliev

Jan 27th, 2025 12:18 AM

Hi,

As for the official documentation on Routing, it seems that you can add the route in bootstrap/app.php. So the code in app.php would be:

<?php

use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;

return Application::configure(basePath: dirname(__DIR__))
    ->withRouting(
        web: __DIR__.'/../routes/web.php',
        api: __DIR__.'/../routes/api.php',
        commands: __DIR__.'/../routes/console.php',
        channels: __DIR__.'/../routes/channels.php',
        health: '/up',
    )
    ->withMiddleware(function (Middleware $middleware) {
        //
    })
    ->withExceptions(function (Exceptions $exceptions) {
        //
    })->create();
Report
1
produkt

Jan 27th, 2025 10:21 AM

Does this replace everything already there? Am I supposed to merge them somehow?

Edit: to merge them both enter this at top of file and keep the rest the same

use Illuminate\Foundation\Application;

$app = Application::configure(basePath: $_ENV['APP_BASE_PATH'] ?? dirname(__DIR__))
    ->withRouting(health: '/up')->create();