wroting code to interact backend with frontend