Pagination on the list, optional auth
This commit is contained in:
+11
-3
@@ -10,7 +10,7 @@ SimpleRouter::error(function (Request $request, Exception $exception) {
|
||||
});
|
||||
// Index
|
||||
SimpleRouter::all("/", function () {
|
||||
redirect("docs", 301);
|
||||
Response::redirect("docs", 301);
|
||||
});
|
||||
|
||||
/*
|
||||
@@ -18,15 +18,23 @@ SimpleRouter::all("/", function () {
|
||||
*/
|
||||
// Login
|
||||
SimpleRouter::post("/login", [Api\Login\Login::class, "post"]);
|
||||
// Register and confirm
|
||||
SimpleRouter::post("/register", [Api\Register\Register::class, "post"]);
|
||||
SimpleRouter::patch("/register", [Api\Register\Register::class, "patch"]);
|
||||
/*
|
||||
* Optional Auth
|
||||
*/
|
||||
SimpleRouter::group(["middleware" => Khofmann\Auth\OptAuth::class], function () {
|
||||
// List posts with user data
|
||||
SimpleRouter::get("/posts", [Api\Posts\Posts::class, "get"]);
|
||||
});
|
||||
/*
|
||||
* Normal Auth routes
|
||||
*/
|
||||
SimpleRouter::group(["middleware" => Khofmann\Auth\Auth::class], function () {
|
||||
// Login
|
||||
// Logout
|
||||
SimpleRouter::post("/logout", [Api\Logout\Logout::class, "post"]);
|
||||
// Get any user
|
||||
// Get user
|
||||
SimpleRouter::get("/user/{id}", [Api\User\User::class, "get"]);
|
||||
// Update self
|
||||
SimpleRouter::patch("/user/self", [Api\User\User::class, "patchSelf"]);
|
||||
|
||||
Reference in New Issue
Block a user