405 NOT_ALLOWED - windows 11, xampp 8.2, slim 4 and insomnia

Hi guys;

I have windows 11, xampp 8.2 (php 8.2), slim 4 and insomnia.

When a tried any tests from slim website, i receive this:

{
“statusCode”: 405,
“error”: {
“type”: “NOT_ALLOWED”,
“description”: “Method not allowed. Must be one of: OPTIONS”
}
}

How a solve this ? I have any experience with slim 3 with windows 10 and php 7.4 and i never received this.

I can´t run a simple “hellow world”…

Tanks;

Need more information, but your client is sending OPTIONS to a URL that isn’t expecting that. At a guess it’s a CORS thing.

I´m trying to use the small samples from de slim website…

<?php

declare(strict_types=1);

use App\Application\Actions\User\ListUsersAction;
use App\Application\Actions\User\ViewUserAction;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\App;
use Slim\Interfaces\RouteCollectorProxyInterface as Group;

return function (App $app) {
    $app->options('/{routes:.*}', function (Request $request, Response $response) {
        // CORS Pre-Flight OPTIONS Request Handler
        return $response;
    });

    $app->get('/', function (Request $request, Response $response) {
        $response->getBody()->write('Hello world!');
        return $response;
    });

    $app->group('/users', function (Group $group) {
        $group->get('', ListUsersAction::class);
        $group->get('/{id}', ViewUserAction::class);
    });
   
};