restructure and adde amplify for front-end rest api