This text is a part of my ongoing FastAPI 101 series. In my earlier article I spoke about what FastAPI is, information sorts and Pydantic.
This chapter may have little or no code, we are going to evaluate a core idea for APIs — async and await — that is so necessary that I’d moderately we ensure that to totally perceive the idea earlier than we create our first API undertaking (spoiler of subsequent article).
Asynchronous code is a option to inform your program, sooner or later within the code, that it must watch for one thing else to complete some other place. Your program will come again each time it has an opportunity as a result of it’s ready once more or every time it completed all of the work it had at that time.
As soon as your program finishes a process, it takes the primary subsequent process to complete and continues no matter it needed to do with it.
That “watch for one thing else” usually refers to I/O operations which can be comparatively “sluggish” (in comparison with the pace of the processor and the RAM reminiscence).