Fast API Flashcards

(12 cards)

1
Q

What is Fast API?

A

FAPI is a fast (high-performance), web framework for building APIs with Python based on standard Python type hints.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the key features of Fast API?

A
  • Fast: on par with NodeJS and Go.
  • Fast to code
  • Fewer bugs
  • Intuitive autocomplete
  • ## Easy to use/learn
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What big companies have used FastAPI?

A

Microsoft, Netflix, Cisco

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is FastAPI built on top of?

A

Starlette for web parts.
Pydantic for data parts.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you install FastAPI?

A

pip install “fastapi[standard]”. Quotes ensure it works in all terminals

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How might the simplest possible Fast API main.py file look?

A

from fastapi import FastAPI
app = FastAPI()
@app.get(“/”)
def read_root():
. return {“Hello”: “World”}}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How to run your main.py FastAPI file?

A

fastapi dev main.py

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the default port for FastAPI?

A

8000

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How would you set up a get route for specific items?

A

@app.get(“/items/{item_id}”)
def read_item(item_id: int, query: str):
return {“item_id”: item_id, “query”: query}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How can you quickly see the routes that you’ve set up?

A

Go to port http://127.0.0.1:8000/docs in your browser or 8000/redocs (unofficial?)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is Pydantic and how is it often used with FastAPI?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly