Move routing and extract POST handler.