finalproject-quiz / quiz-project

0 stars 0 forks source link

Connect front end to backend #22

Open ShalimaKhanum2605 opened 1 year ago

ShalimaKhanum2605 commented 1 year ago

Technical Implementation

  1. created useEffect function that sends request for data from backend server (fetch from URL from backend)
  2. returned state with updated data (res.json)
  3. created login function that takes user's data of name as a string
  4. sends request to backend to users endpoint
  5. method is post request which is sending data to backend
  6. content type is header and the body is where its being sent (body: JSON.stringify({ name: user, score: 0 }))
  7. name is the class User's public string in Quiz.cs set to the User's input of their username
  8. score is set to initially 0
ShalimaKhanum2605 commented 1 year ago

Image