code for the middleware course