creating basic API by refactoring to add JSON response in prod cont