update index controller, add health check

This commit is contained in:
2025-11-12 09:35:20 +08:00
parent 8f6793ebc4
commit 23a230a9f3
+20 -2
View File
@@ -12,16 +12,34 @@ declare(strict_types=1);
namespace App\Controller; namespace App\Controller;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\RequestMapping;
#[Controller]
class IndexController extends AbstractController class IndexController extends AbstractController
{ {
// #[RequestMapping('/', methods: ['GET', 'POST'])]
public function index() public function index()
{ {
$user = $this->request->input('user', 'Hyperf');
$method = $this->request->getMethod(); $method = $this->request->getMethod();
return [ return [
'method' => $method, 'method' => $method,
'message' => "Hello {$user}.", 'message' => "Dataflow App",
];
}
#[RequestMapping('/favicon.ico', methods: ['GET', 'POST'])]
public function favicon()
{
return [];
}
#[RequestMapping('/health', methods: 'GET')]
public function health()
{
return [
'message' => "System status ok",
]; ];
} }
} }