-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
50 lines (41 loc) · 1.37 KB
/
main.py
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
# (c) 2022-2023, Akkil M G (https://github.com/HeimanPictures)
# License: GNU General Public License v3.0
import uvicorn
from fastapi import FastAPI
from fastapi.responses import JSONResponse
from fastapi.middleware.cors import CORSMiddleware
from config import *
import router.api_router as api_router
app = FastAPI(
title="Cerify",
description="This is an application as a service to store certificate for SOSC Events.",
version="0.0.2",
contact={
"name": "Akkil M G",
"url": "http://github.com/HeimanPictures",
},
license_info={
"name": "GNU GENERAL PUBLIC License v3.0",
"url": "https://www.gnu.org/licenses/gpl-3.0.en.html",
},
docs_url="/method",
redoc_url="/",
)
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.get("/")
async def home():
return JSONResponse({ "success": True })
app.include_router(api_router.router, prefix="/api/v1")
if __name__ == "__main__":
try:
print('------------------- Initalizing Web Server -------------------')
print('----------------------- Service Started -----------------------')
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)
except KeyboardInterrupt:
print('----------------------- Service Stopped -----------------------')