Cannot understand the setup of API middleware

Please anyone explain me the setup of API middleware. How it’s being working with backend?