Initial Commit

This commit is contained in:
Owen Rummage
2025-07-29 17:44:43 -05:00
commit 6653bc5e47
13 changed files with 525 additions and 0 deletions

42
public/index.php Normal file
View File

@@ -0,0 +1,42 @@
<?php
use Latte\Engine;
require "../vendor/autoload.php";
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . "/../");
try {
$dotenv->load();
} catch (Exception $e) {
}
// Set paths for controllers
Flight::path("../app/controllers");
Flight::path("../app/middlewares");
// Register latte view engine
Flight::register("view", Engine::class, [], function ($latte) {
$latte->setTempDirectory(__DIR__ . "/../cache/");
$latte->setLoader(
new \Latte\Loaders\FileLoader(__DIR__ . "/../app/views/"),
);
});
require "../app/routes.php";
// Login route
Flight::route("GET /auth/login", function () {
Auth::login("/admin");
});
// Logout route
Flight::route("GET /auth/logout", function () {
Auth::logout();
});
// API route to get current user data
Flight::route("GET /debug/user", function () {
$user = Auth::user();
Flight::json($user);
});
Flight::start();