Extract routing middleware