Initial FastAPI application
This commit is contained in:
1 parent
a34e861612
commit
b118e1d539
6 files changed
+98
No files matched your search
Whitespace-only changes.
+26
@@ -0,0 +1,26 @@
|
||||
from fastapi import FastAPI
|
||||
|
||||
app = FastAPI(
|
||||
title="FastAPI Demo",
|
||||
description="My first application with FastAPI",
|
||||
version="1.0.0",
|
||||
)
|
||||
|
||||
|
||||
@app.get("/")
|
||||
async def root():
|
||||
return {
|
||||
"message": "Hello from FastAPI!",
|
||||
"application": "fastapi-demo",
|
||||
"version": "1.0.0",
|
||||
}
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
async def health():
|
||||
return {"status": "ok"}
|
||||
|
||||
|
||||
@app.get("/hello/{name}")
|
||||
async def hello(name: str):
|
||||
return {"message": f"Hello, {name}!"}
|
||||
Reference in new issue
Block a user