PHP Classes

File: public/routes.php

Recommend this page to a friend!
  Classes of Rodrigo Faustino   PHP MVC App   public/routes.php   Download  
File: public/routes.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP MVC App
MVC based application for the Web and as an API
Author: By
Last change:
Date: 12 days ago
Size: 1,003 bytes
 

Contents

Class file image Download
<?php
namespace App;
use
App\core\Router;
$router = new Router();

// Rotas para páginas
$router->addRoute('GET', '/', 'UserController', 'index');
$router->addRoute('GET', '/user/create', 'UserController', 'create');
$router->addRoute('GET', '/user/edit/{id}', 'UserController', 'edit');
$router->addRoute('GET', '/user/view/{id}', 'UserController', 'show');

$router->addRoute('POST', '/user/store', 'UserController', 'store');
$router->addRoute('POST', '/user/update/{id}', 'UserController', 'update');
$router->addRoute('GET', '/user/delete/{id}', 'UserController', 'delete');

// Rotas para API
$router->addRoute('GET', '/api/users', 'ApiUserController', 'apiGetAllUsers');
$router->addRoute('GET', '/api/user/{id}', 'ApiUserController', 'apiGetUser');
$router->addRoute('POST', '/api/users', 'ApiUserController', 'apiCreateUser');
$router->addRoute('PUT', '/api/user/{id}', 'ApiUserController', 'apiUpdateUser');
$router->addRoute('DELETE', '/api/user/{id}', 'ApiUserController', 'apiDeleteUser');