move route code to controller