forked from mrepol742/phpspa-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
46 lines (38 loc) · 1.22 KB
/
index.php
File metadata and controls
46 lines (38 loc) · 1.22 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
43
44
45
46
<?php
require __DIR__ . "/vendor/autoload.php";
use phpSPA\App;
use phpSPA\Component;
require __DIR__ . "/pages/layouts/Layout.php";
require __DIR__ . "/pages/Home.php";
require __DIR__ . "/pages/auth/Login.php";
require __DIR__ . "/pages/auth/Logout.php";
require __DIR__ . "/pages/auth/Register.php";
require __DIR__ . "/pages/user/Profile.php";
require __DIR__ . "/controllers/auth/AuthController.php";
$app = new App("Layout");
$app->defaultTargetID("app");
$app->attach(new Component("Home")->title("Home")->method("GET")->route("/"));
$app->attach(
new Component("Login")->title("Login")->method("GET")->route("/login")
);
$app->attach(
new Component("Logout")->title("Logout")->method("GET")->route("/logout")
);
$app->attach(
new Component("Register")
->title("Login")
->method("GET")
->route("/register")
);
$app->attach(
new Component("UserProfile")
->title("Profile")
->method("GET")
->route("/profile")
);
$app->attach(new Component("LoginHandler")->method("POST")->route("/login"));
$app->attach(
new Component("RegisterHandler")->method("POST")->route("/register")
);
$app->attach(new Component("LogoutHandler")->method("POST")->route("/logout"));
$app->run();