Modern APIs with FastAPI and Python Transcripts
Chapter: Building our first API
Lecture: Concept: A minimal API endpoint
0:00 Now that we've built our first FastAPI endpoint, let's just review what it takes to get a minimal API endpoint up and
0:08 running in an application. Pretty simple. So we're gonna import FastAPI to use FastAPI and then we have to have a server to run it,
0:15 so we're gonna use uvicorn, and we create an instance of the FastAPI object, calling it
0:21 "api", create a function, some kind of method that we're going to call, and we're gonna decorate it with http verbs and their configuration.
0:30 So an http get against api/calculate will run this right here. And then we just say "uvicorn.run" we pass it the API object,
0:40 we say the host and we say the port and that's it, we're off to the races. We have our app up and running.