API Development

Hello World

API Development / Hello World

Hello World

Getting Started

 

The first step in creating a FastAPI app is to declare the application object of FastAPI class.

from fastapi import FastAPI app = FastAPI()

This app object is the main point of interaction of the application with the client browser. The uvicorn server uses this object to listen to clients request.

The next step is to create path operation. Path is a URL which when visited by the client invokes visits a mapped URL to one of the HTTP methods, an associated function is to be executed. We need to bind a view function to a URL and the corresponding HTTP method. For example, the index() function corresponds to / path with get operation.

@app.get("/") async def root():   return {"message": "Hello World"}

Technology
API Development
want to connect with us ?
Contact Us