freeleaps-service-hub/apps/metrics/webapi/main.py
weicao 44f08eee68 Add metrics service with user registration API endpoints
- Add complete metrics microservice structure
- Implement StarRocks database integration
- Add user registration data query APIs:
  - Daily registered users by date range
  - Recent N days registration data
  - Registration data by start date and days
  - Registration summary statistics
- Add comprehensive error handling and logging
- Include test scripts and documentation
2025-09-11 17:35:20 +08:00

37 lines
878 B
Python

from webapi.bootstrap.application import create_app
from webapi.config.site_settings import site_settings
from fastapi.responses import RedirectResponse
import uvicorn
from typing import Any
from webapi.routes import registration
app = create_app()
# Include routers
app.include_router(registration.router)
@app.get("/", status_code=301)
async def root():
"""
TODO: redirect client to /docs
"""
return RedirectResponse("docs")
if __name__ == "__main__":
uvicorn.run(
app="main:app", host=site_settings.SERVER_HOST, port=site_settings.SERVER_PORT
)
def get_context() -> Any:
# Define your context function. This is where you can set up authentication, database connections, etc.
return {}
def get_root_value() -> Any:
# Define your root value function. This is where you can set up the root value for GraphQL.
return {}