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