feat: initialize zhixing-web with React, React Router, and Tailwind CSS
- Set up the main application structure with App component and routing. - Implemented global state management for UI theme using Zustand. - Created API utilities for fetching system status. - Developed system status page with responsive design and theme toggle. - Added testing setup with Vitest and initial tests for system status page. - Configured TypeScript with appropriate settings for the application. - Integrated Tailwind CSS for styling and responsive design. - Established Vite configuration for development and testing environments.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
"""HTTP interface composition."""
|
||||
@@ -0,0 +1,10 @@
|
||||
"""Top-level HTTP route catalogs."""
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
from zhixing_server.interfaces.http.system import operational_router, system_router
|
||||
|
||||
api_v1_router = APIRouter(prefix="/api/v1")
|
||||
api_v1_router.include_router(system_router, prefix="/system", tags=["system"])
|
||||
|
||||
__all__ = ["api_v1_router", "operational_router"]
|
||||
@@ -0,0 +1,51 @@
|
||||
"""Operational endpoints that do not belong to a business context."""
|
||||
|
||||
from typing import Annotated, Literal
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
from pydantic import BaseModel
|
||||
|
||||
from zhixing_server.bootstrap.config import Settings, get_settings
|
||||
|
||||
operational_router = APIRouter()
|
||||
system_router = APIRouter()
|
||||
|
||||
|
||||
class HealthResponse(BaseModel):
|
||||
"""Minimal response used by container health probes."""
|
||||
|
||||
status: Literal["ok"]
|
||||
|
||||
|
||||
class SystemStatusResponse(HealthResponse):
|
||||
"""Non-domain runtime metadata displayed by the frontend smoke slice."""
|
||||
|
||||
service: str
|
||||
environment: str
|
||||
|
||||
|
||||
@operational_router.get("/healthz", response_model=HealthResponse, include_in_schema=False)
|
||||
def health() -> HealthResponse:
|
||||
"""Report whether the HTTP process can serve requests.
|
||||
|
||||
Returns:
|
||||
A stable response suitable for container health checks.
|
||||
"""
|
||||
return HealthResponse(status="ok")
|
||||
|
||||
|
||||
@system_router.get("/status", response_model=SystemStatusResponse)
|
||||
def system_status(settings: Annotated[Settings, Depends(get_settings)]) -> SystemStatusResponse:
|
||||
"""Expose safe runtime metadata for end-to-end connectivity checks.
|
||||
|
||||
Args:
|
||||
settings: Validated process settings injected by FastAPI.
|
||||
|
||||
Returns:
|
||||
The service name, environment, and current availability state.
|
||||
"""
|
||||
return SystemStatusResponse(
|
||||
status="ok",
|
||||
service=settings.app_name,
|
||||
environment=settings.app_env,
|
||||
)
|
||||
Reference in New Issue
Block a user