refactored the products controller to respond to JSOn