| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- require __DIR__ . '/../vendor/autoload.php';
- $path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
- $file = __DIR__ . $path;
- if (php_sapi_name() === 'cli-server' && is_file($file)) {
- return false;
- }
- if (class_exists(Dotenv\Dotenv::class) && file_exists(__DIR__ . '/../.env')) {
- Dotenv\Dotenv::createImmutable(
- dirname(__DIR__),
- null,
- true
- )->safeLoad();
- }
- error_reporting(E_ALL);
- use FrameworkX\App;
- use Middlewares\HmacAuthMiddleware;
- use Middlewares\JWTAuthMiddleware;
- $app = new App();
- $authHmac = new HmacAuthMiddleware();
- $authJwt = new JWTAuthMiddleware();
- $app->get('/hmachelloworld', $authHmac,\Controllers\HelloController::class);
- $app->get('/jwthelloworld', $authJwt,\Controllers\HelloController::class);
- $app->post('/login', \Controllers\LoginController::class);
- $app->post('/register', \Controllers\RegisterController::class);
- $app->run();
|