Skip to content

Commit

Permalink
refactor: remove global Router
Browse files Browse the repository at this point in the history
  • Loading branch information
winstxnhdw committed Nov 7, 2024
1 parent 7a48ca6 commit 95006e5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
7 changes: 5 additions & 2 deletions server/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from litestar import Litestar, Response
from litestar import Litestar, Response, Router
from litestar.openapi import OpenAPIConfig
from litestar.openapi.spec import Server
from litestar.status_codes import HTTP_500_INTERNAL_SERVER_ERROR
from picologging import getLogger

from server.api import v1
from server.api.v1.index import index
from server.api.v1.transcribe import TranscriberController
from server.config import Config
from server.lifespans import load_model

Expand Down Expand Up @@ -34,6 +35,8 @@ def app() -> Litestar:
-------
the Litestar application
"""
v1 = Router('/v1', tags=['v1'], route_handlers=[index, TranscriberController])

return Litestar(
openapi_config=OpenAPIConfig(title='CapGen', version='1.0.0', servers=[Server(url=Config.server_root_path)]),
exception_handlers={HTTP_500_INTERNAL_SERVER_ERROR: exception_handler},
Expand Down
1 change: 0 additions & 1 deletion server/api/__init__.py

This file was deleted.

6 changes: 0 additions & 6 deletions server/api/v1/__init__.py

This file was deleted.

0 comments on commit 95006e5

Please sign in to comment.