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