Add "get_middleware()" function to app

The only way I have managed to get this working is to return a pointer. I'd prefer a reference, but there you go. It works :p
should be renamed to `get_index_of_element_from_tuple_by_type_impl`