File size: 1,432 Bytes
b6f0f70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
61
62
63
64
65
66
67
68
69
70
71
from fastapi import FastAPI
from app.config import settings
from fastapi.responses import RedirectResponse
from fastapi.middleware.cors import CORSMiddleware
from app.routers import user, auth, upload, pet, disease_detection, doctor

app = FastAPI()

origins = [
    settings.CLIENT_ORIGIN,
]

app.add_middleware(
    middleware_class = CORSMiddleware,
    allow_origins = ["*"],
    allow_methods = ["*"],
    allow_headers = ["*"],
    allow_credentials = True
)

# Auth Routes Group
app.include_router(
    tags = ['Auth'],
    router = auth.router,
    prefix = '/api/auth'
)

# User Routes Group
app.include_router(
    tags = ['Users'],
    router = user.router,
    prefix = '/api/users'
)

# Upload Routes Group
app.include_router(
    tags = ['Upload'],
    router = upload.router,
    prefix = '/api/upload'
)

# Pet Routes Group
app.include_router(
    tags = ['Pets'],
    router = pet.router,
    prefix = '/api/pets'
)

# Doctor Routes Group
app.include_router(
    tags = ['Doctors'],
    router = doctor.router,
    prefix = '/api/doctors'
)

# Disease Detection Routes Group
app.include_router(
    tags = ['Disease Detection'],
    router = disease_detection.router,
    prefix = '/api/disease_detection'
)

# Main Routes Group
@app.get('/api/checker', tags = ['Main'])
def checker():
    return {'message': 'Hello Docpet!'}

@app.get("/", tags = ['Main'])
def root():
    return RedirectResponse(url="/docs")