Skip to content

Commit 50540dc

Browse files
author
Pranav Srivastava
committed
updates
1 parent 28f6a53 commit 50540dc

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Procfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
web: uvicorn src.main:app --host=0.0.0.0 --port=${PORT:-5000}
1+
web: uvicorn main:app --host=0.0.0.0 --port=${PORT:-5000}

main.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import socket
2+
import sys
3+
14
from fastapi import FastAPI,Form
25
from fastapi.responses import HTMLResponse
36
from fastapi.templating import Jinja2Templates
@@ -6,6 +9,15 @@
69

710
app = FastAPI()
811
templates = Jinja2Templates(directory="templates/")
12+
hostname = socket.gethostname()
13+
14+
@app.get("/")
15+
async def read_root():
16+
return {
17+
"name": "babybot",
18+
"host": hostname,
19+
"version": f"Hello world! From FastAPI running on Uvicorn. Using Python"
20+
}
921

1022
@app.get("/hello/", response_class=HTMLResponse)
1123
async def hello():

0 commit comments

Comments
 (0)