Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add FastAPI framework with basics section
  • Loading branch information
ACR1209 committed Jan 6, 2025
commit 3e7bb65cd93fd090d33fae152e27dd5607cd8c45
21 changes: 21 additions & 0 deletions snippets/python/[fastapi]/basics/hello-world.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: Hello, World!
description: Returns Hello, World! when it recives a GET request made to the root endpoint.
author: ACR1209
tags: printing,hello-world,web,api
---

```py
from typing import Union
from fastapi import FastAPI

app = FastAPI()


@app.get("/")
def read_root():
return {"msg": "Hello, World!"}

# Usage:
# -> Go to http://127.0.0.1:8000/ and you'll see {"msg", "Hello, World!"}
```
1 change: 1 addition & 0 deletions snippets/python/[fastapi]/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.