controller to handle json post request