solve exercise 11: snake & camel function to middleware