-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
60 lines (48 loc) · 1.63 KB
/
app.py
File metadata and controls
60 lines (48 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"""
Copyright © 2024 Acme Software LLC. All rights reserved.
This software is proprietary and confidential. Unauthorized copying, distribution,
modification, or use of this software, in whole or in part, is strictly prohibited
without prior written permission from Acme Software LLC.
For inquiries, contact: legal@acmesoftware.com
"""
from fastapi import Depends, FastAPI
from fastapi.middleware.cors import CORSMiddleware
from src.api import IncidentRouter, OfficerRouter, WebsocketRouter
from src.utils.api_exception import APIException
from src.utils.auth_bearer import AuthBearer
def create_app() -> FastAPI:
app = FastAPI(
title="Incident Management API",
description="A simple API to manage incidents and assign officers.",
version="1.0.0",
contact={
"name": "Acme Software LLC",
"url": "https://acmesoftware.com",
"email": "info@acmesoftware.com",
},
swagger_ui_parameters={
"syntaxHighlight.theme": "tomorrow-night",
"tryItOutEnabled": True,
"persistAuthorization": True,
},
)
app.include_router(
IncidentRouter,
prefix="/api/v1",
dependencies=[Depends(AuthBearer())],
)
app.include_router(
OfficerRouter,
prefix="/api/v1",
dependencies=[Depends(AuthBearer())],
)
app.include_router(WebsocketRouter)
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_methods=["*"],
allow_headers=["*"],
)
app.add_exception_handler(APIException, APIException.handler)
return app
app = create_app()