Methods implemented in the back - quentinblampey/facteur-de-reussite GitHub Wiki

Accessible methods from the front

Users

POST to api/users/initget

Body : { pseudo } where pseudo is a user pseudo.

Checks the database, if the user already exists, creates its profile. In all cases, returns an instance of user.

GET to api/users

Returns the list of users.

GET to api/users/getid/:id

Params : user id.

Returns the user found by the given id.

Answers

POST to api/answers/:id

Body : { answer, field } where answer is the chosen answer and field the field of the answered question.

Params : user id.

Update the user given the chosen answer. Returns the new user.

Questions

POST to api/questions/:id

Params : user id.

Returns { question, isFinish, user } where isFinish is a boolean (true if there is no more question to ask yet, false otherwise), question is the new question to ask (is not isFinish) ans user the user updated.