PHP Classes

File: backend/index.php

Recommend this page to a friend!
  Classes of Rodrigo Faustino   Fast Router   backend/index.php   Download  
File: backend/index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Fast Router
Route request to controller set in router classes
Author: By
Last change:
Date: 1 month ago
Size: 439 bytes
 

Contents

Class file image Download
<?php
namespace Backend\Api;
use
Backend\Api\Rotas\Router;
use
Backend\Api\Http\HttpHeader;
use
Backend\Api\Rotas\Rotas;

require_once
'../vendor/autoload.php';

HttpHeader::setDefaultHeaders();

if (
$_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
   
http_response_code(204);
    exit();
}

$method = $_SERVER['REQUEST_METHOD'];
$uri = $_SERVER['REQUEST_URI'];

$arrayRotas = Rotas::fastRotas();

Router::resolve($arrayRotas, $method, $uri);