Split handler from controller, make the controller code more concise, and it is convenient to write unit test.