-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
29 lines (22 loc) · 675 Bytes
/
Copy pathmain.py
File metadata and controls
29 lines (22 loc) · 675 Bytes
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
from fastapi import FastAPI
import os
import uvicorn
from app.pages.home import HomePage
from package.TestService import TestService
from fastapi.middleware.cors import CORSMiddleware
app = FastAPI()
# Middleware for Cross-Origin Resource Sharing (optional)
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_methods=["*"],
allow_headers=["*"],
)
foo = TestService("ExampleFoo")
app.include_router(foo.router)
@app.get('/root')
async def read_root():
return {"Message": os.getcwd()}
app.mount('/', HomePage(directory='static', html=True), name='Test Console')
if __name__ == "__main__":
uvicorn.run(app, host="127.0.0.1", port=8000)