Modern APIs with FastAPI and Python Transcripts
Chapter: Course conclusion and review
Lecture: Review: A minimal API endpoint
0:00 we've seen that creating a basic, simplified,
0:03 FastAPI application is really simple.
0:06 So all we have to do is import FastAPI to use it and
0:09 then we got to run it somehow
0:10 so we're using uvicorn as the server.
0:13 Then we create either app or
0:16 API equals FastAPI dot FastAPI, this is very flask-like. And
0:20 then we create some function and we express some kind of URL and http
0:24 verb combination. So API dot get this URL and it can return
0:29 basically whatever. If it returns a dictionary or a list that becomes JSON,
0:33 this is also JSON, but it's just gonna be the number four,
0:36 and that's it. In order to serve it,
0:38 we just have to call uvicorn dot run and pass it
0:41 the API and optionally we can explicitly set the host and the port
0:45 this way. This might not be the best way to organize large production
0:50 grade applications, but it gives you a sense of what's involved getting things up and running.