-
Notifications
You must be signed in to change notification settings - Fork 112
/
main.py
40 lines (30 loc) · 840 Bytes
/
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
import os
import uvicorn
from fastapi import FastAPI
from fastapi.responses import JSONResponse
from fastapi.templating import Jinja2Templates
from chatgpt_linebot.urls import line_app
app = FastAPI()
templates = Jinja2Templates(directory="templates")
app.include_router(line_app)
@app.get("/", response_class=JSONResponse)
async def home() -> JSONResponse:
"""Home Page
Returns:
JSONResponse: Hello World!
"""
message = {"stauts": "success", "message": "Hello World!"}
return JSONResponse(content=message)
if __name__ == "__main__":
# Local WSGI: Uvicorn
port = int(os.getenv("PORT", 8080))
uvicorn.run(
"main:app",
host="0.0.0.0",
port=port,
workers=4,
log_level="info",
access_log=True,
use_colors=True,
reload=True,
)