Skip to content

Commit 3e7bb65

Browse files
committed
Add FastAPI framework with basics section
1 parent 75f586a commit 3e7bb65

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: Hello, World!
3+
description: Returns Hello, World! when it recives a GET request made to the root endpoint.
4+
author: ACR1209
5+
tags: printing,hello-world,web,api
6+
---
7+
8+
```py
9+
from typing import Union
10+
from fastapi import FastAPI
11+
12+
app = FastAPI()
13+
14+
15+
@app.get("/")
16+
def read_root():
17+
return {"msg": "Hello, World!"}
18+
19+
# Usage:
20+
# -> Go to http://127.0.0.1:8000/ and you'll see {"msg", "Hello, World!"}
21+
```

snippets/python/[fastapi]/icon.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)