customized middleware example