File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
www/server/app/Controller Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 88use Psr \Http \Server \RequestHandlerInterface ;
99use BitFrame \Container ;
1010use BitFrame \FastRoute \Route ;
11+ use BitFrame \Http \Message \JsonResponse ;
1112
1213class DefaultController
1314{
@@ -16,7 +17,7 @@ public function __construct(
1617 ) {}
1718
1819 #[Route(['GET ' ], '/hello/{action} ' )]
19- public function testAction (
20+ public function indexAction (
2021 ServerRequestInterface $ request ,
2122 RequestHandlerInterface $ handler ,
2223 ): ResponseInterface {
@@ -29,4 +30,17 @@ public function testAction(
2930
3031 return $ response ;
3132 }
33+
34+ #[Route(['GET ' ], '/json ' )]
35+ public function jsonAction (): ResponseInterface
36+ {
37+ $ globals = $ this ->container ['globals ' ];
38+
39+ return JsonResponse::create ([
40+ 'data ' => [
41+ 'title ' => $ globals ['title ' ],
42+ 'mainHeading ' => 'Build Something Amazing Today! ' ,
43+ ],
44+ ]);
45+ }
3246}
You can’t perform that action at this time.
0 commit comments