Complete the code to create a FastAPI app instance.
from fastapi import [1] app = [1]()
FastAPI apps are created by instantiating the FastAPI class.
Complete the code to define a route in Flask.
from flask import Flask app = Flask(__name__) @app.route([1]) def home(): return "Hello from Flask!"
In Flask, the root route is defined with "/".
Fix the error in this Django view function to return a simple HTTP response.
from django.http import HttpResponse def home(request): return [1]("Hello from Django!")
render without a template.Django views return an HttpResponse object to send text responses.
Fill both blanks to create a FastAPI GET endpoint that returns a greeting.
from fastapi import FastAPI app = FastAPI() @app.[1]("/greet") def greet(): return [2]
post decorator for a GET endpoint.FastAPI uses @app.get to define GET routes and returns JSON by default.
Fill all three blanks to create a Django URL pattern for the home view.
from django.urls import path from .views import home urlpatterns = [ path([1], [2], name=[3]) ]
"/" instead of empty string for root path.Django URL patterns use an empty string "" for the root path, the view function name, and a string name for the route.
