PHP Classes

File: restAPI/index.php

Recommend this page to a friend!
  Classes of Hicri   PHP Project JWT   restAPI/index.php   Download  
File: restAPI/index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Project JWT
REST API example to perform user login operations
Author: By
Last change:
Date: 4 months ago
Size: 1,211 bytes
 

Contents

Class file image Download
<?php


require_once __DIR__ . '/vendor/autoload.php';
require_once
__DIR__ . '/Controllers/Login.php';
require_once
__DIR__ . '/Controllers/Item.php';



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

require_once
__DIR__ . '/models/Database.php';
require_once
__DIR__ . '/Control.php';






// Create Router instance
$router = new \Bramus\Router\Router();

$router->set404(function () {
   
header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
    echo
'404, route not found!';
});


$router->get('/', function() {
    echo
'Home Page';
});



/* Login / All - Single - Register - Login Update - Login Delete */


$router->post('/login', 'login@index');
$router->post('/login/all', 'login@all');
$router->post('/login/single', 'login@single');
$router->post('/login/register', 'login@register');
$router->post('/login/update', 'login@update');
$router->post('/login/delete', 'login@delete');


/* Item / All - Single - Create - Update - Delete */


$router->post('/item/all', 'Item@all');
$router->post('/item/single', 'Item@single');
$router->post('/item/create', 'Item@create');
$router->post('/item/update', 'Item@update');
$router->post('/item/delete', 'Item@delete');






$router->run();





?>