adding middleware code sample