-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
42 lines (33 loc) · 1.13 KB
/
index.php
File metadata and controls
42 lines (33 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
* Garbage Collection System
* Main entry point
*/
// Define base path
define('BASE_PATH', __DIR__);
// Load composer autoloader if exists
if (file_exists(BASE_PATH . '/vendor/autoload.php')) {
require_once BASE_PATH . '/vendor/autoload.php';
}
// Load configuration
require_once BASE_PATH . '/app/config/config.php';
// Load core files
require_once BASE_PATH . '/app/core/Database.php';
require_once BASE_PATH . '/app/core/Router.php';
require_once BASE_PATH . '/app/core/Controller.php';
require_once BASE_PATH . '/app/core/Model.php';
// Load helpers
require_once BASE_PATH . '/app/helpers/functions.php';
require_once BASE_PATH . '/app/helpers/ErrorHandler.php';
// Start session
session_start();
// Initialize router
$router = new Router();
// Define routes
$router->addRoute('GET', '/', 'UserController@index');
$router->addRoute('POST', '/login', 'AuthController@login');
$router->addRoute('GET', '/logout', 'AuthController@logout');
$router->addRoute('POST', '/register', 'UserController@register');
$router->addRoute('POST', '/company/register', 'CompanyController@register');
// Dispatch the request
$router->dispatch();