Talks: Inside your web framework: intro to the ASGI spec, middleware and apps
Saturday - April 22nd, 2023 10:45 a.m.-11:15 a.m. in 255ABC
What do FastAPI and Django have in common? They both use ASGI under the hood. ASGI, which stands for Asynchronous Server Gateway Interface, is a specification and API for asynchronous, event-driven web applications. The goal of this talk is to peel back the curtain on the internals of this specification and empower you to debug ASGI apps, write custom ASGI middleware, and simplify application lifecycles and serving.
We will begin by discussing the basics of the ASGI specification and how it works. Then, we will move on to writing a simple ASGI app using pure, hand-crafted Python, without any frameworks or libraries. After that, we will cover ASGI middleware, which is a powerful tool that allows us to modify the behavior of our ASGI apps without changing the underlying code. We will show how to write custom middleware and how to use it to add features such as authentication or request body processing. Finally, we will discuss the serving of ASGI applications, focusing on how to use Uvicorn programmatically and take control of your event loop.