22 lines
544 B
PHP
22 lines
544 B
PHP
<?php
|
|
|
|
namespace routes;
|
|
|
|
use traits\route_t;
|
|
|
|
class optionsRoute
|
|
{
|
|
use route_t;
|
|
|
|
public function run(): void
|
|
{
|
|
// When the OPTIONS method is requested, accept all using regex
|
|
$this->options('/.*', function () {
|
|
header('Access-Control-Allow-Origin: *');
|
|
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
|
|
header('Access-Control-Allow-Headers: *');
|
|
header('Content-Type: application/json');
|
|
http_response_code(200);
|
|
});
|
|
}
|
|
} |