add conditional middleware example. Closes #5