Make your first Hello World program with Fast API ⚡

Make your first Hello World program with Fast API ⚡

This blog will show you how you can create your first hello world program with fast api!!

·

2 min read

Hello Everyone 👋

hello

Fast API is a software framework for developing web applications in Python. And as its name suggests, this is blazingly fast ⚡. As a web developer, this is a pretty great and needed skill, it can be your entry point to APIs in the backend!!

     mkdir fastapi
     cd fastapi
     touch main.py
     pip install fastapi uvicorn
     |
     |-main.py
    code .
-main.py

     from fastapi import FastAPI
     app = FastAPI()
-main.py

     from fastapi import FastAPI
     app = FastAPI()

     @app.get('/')
     async def root():
         return {'msg': 'hello world'}

Here in the above example, in the get method, we are adding '/' as a parameter, this defines that the function should return hello world at the base URL of the server!!

     uvicorn main:app --reload

Screenshot (190).png

Did you find this article valuable?

Support Anurag's Blog by becoming a sponsor. Any amount is appreciated!