Stephan van Hulst wrote:How are you keeping track what user is logged in, and where and how do you store what answer a user has given to a particular question?
I am keeping track of the login using a Json Web Token. I have an authentication filter in the server that makes sure the token is valid before the request reaches the Controller.
And regarding storing the data,
I hava a "user_answer" table that stores: quiz_id , user_id and quiz_answer_id.
On my current impelementation I have and endpoint that adds an answer to the table and another endpoint that retrieves a quiz.
Both of them take the user id from the token,
But I am wondering if this is a good practice or should I split the request into two requests
(at least the one that retrieves a quiz) :
first get the quiz , then get the answer by user.