Add an example with custom middleware

May help with #326