79268855

Date: 2024-12-10 15:45:22
Score: 1.5
Natty:
Report link

Actually I want to post my solution here, thanks for the help from ZaidMalek.

As for the official documentation on Routing, it seems that we need to add the route of api.php 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',
        health: '/up',
    )
    ->withMiddleware(function (Middleware $middleware) {
        //
    })
    ->withExceptions(function (Exceptions $exceptions) {
        //
    })->create();
Reasons:
  • Blacklisted phrase (0.5): thanks
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Taiwan No.1