Server-Side Scripting/Introduction/Python (FastAPI)

main.py

edit
# Displays "Hello world!"
#
# References:
#   https://en.wikiversity.org/wiki/Flask/Hello_World
#   https://fastapi.tiangolo.com/tutorial/first-steps/
#   https://fastapi.tiangolo.com/advanced/custom-response/

from fastapi import FastAPI
from fastapi.responses import HTMLResponse
import uvicorn

app = FastAPI()

@app.get('/', response_class=HTMLResponse)
async def get_root():
    return "Hello world!"

if __name__ == "__main__":
    uvicorn.run("main:app", host="0.0.0.0", port=5000)

Try It

edit

Copy and paste the code above into the following free online development environment or use your own Python (FastAPI) compiler / interpreter / IDE.

See Also

edit