feat(cloud-api): add workspace application entrypoint
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
from cloud_api.app import create_app
|
||||
|
||||
__all__ = ["create_app"]
|
||||
@@ -0,0 +1,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from fastapi import FastAPI
|
||||
|
||||
|
||||
def create_app() -> FastAPI:
|
||||
"""Create the independently deployable cloud API application."""
|
||||
return FastAPI(title="Device Cloud API")
|
||||
@@ -0,0 +1,20 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
from collections.abc import Sequence
|
||||
|
||||
|
||||
def main(argv: Sequence[str] | None = None) -> None:
|
||||
parser = argparse.ArgumentParser(description="Run the Device Cloud API")
|
||||
parser.add_argument("--host", default="127.0.0.1")
|
||||
parser.add_argument("--port", default=8001, type=int)
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
import uvicorn
|
||||
|
||||
uvicorn.run(
|
||||
"cloud_api.app:create_app",
|
||||
factory=True,
|
||||
host=args.host,
|
||||
port=args.port,
|
||||
)
|
||||
Reference in New Issue
Block a user