0
0
FastAPIframework~10 mins

Uvicorn server basics in FastAPI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the Uvicorn server module.

FastAPI
import [1]
Drag options to blanks, or click blank then click option'
Afastapi
Buvicorn
Crequests
Dflask
Attempts:
3 left
💡 Hint
Common Mistakes
Importing 'fastapi' instead of 'uvicorn'.
Using unrelated modules like 'requests' or 'flask'.
2fill in blank
medium

Complete the code to run the FastAPI app named 'app' with Uvicorn.

FastAPI
uvicorn.run([1], host="127.0.0.1", port=8000)
Drag options to blanks, or click blank then click option'
Aapp
BApp
C"app"
Dapplication
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the app name as a string instead of the variable.
Using a capitalized or incorrect variable name.
3fill in blank
hard

Fix the error in the code to run Uvicorn with auto-reload enabled.

FastAPI
uvicorn.run(app, host="127.0.0.1", port=8000, [1]=True)
Drag options to blanks, or click blank then click option'
Aauto_reload
Blive_reload
Creload
Ddebug
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect parameter names like 'auto_reload' or 'debug'.
Misspelling the parameter name.
4fill in blank
hard

Fill both blanks to run Uvicorn on all network interfaces with debug mode off.

FastAPI
uvicorn.run(app, host=[1], port=[2], debug=False)
Drag options to blanks, or click blank then click option'
A"0.0.0.0"
B8000
C127.0.0.1
D8080
Attempts:
3 left
💡 Hint
Common Mistakes
Using localhost IP instead of all interfaces.
Choosing a non-standard port without reason.
5fill in blank
hard

Fill all three blanks to run Uvicorn with app instance, host, and port from variables.

FastAPI
uvicorn.run([1], host=[2], port=[3])
Drag options to blanks, or click blank then click option'
Amy_app
B"localhost"
C9000
Dapp
Attempts:
3 left
💡 Hint
Common Mistakes
Using undefined app variable names.
Passing host without quotes.
Using default port instead of specified.