Added code to api side to handle requests from front