- Route
/: It is the home page. It shows the list of all surveys available and ready to be answered to. - Route
/login: It is used for logging in. It shows the form where inserting the admin credentials . - Route
/surveys:id: It is used for answering to a survey. It shows all the questions of the survey. The "id" is the id belonging to that survey. - Route
/admin: It is the personal page of the admin. It shows all the questions published by the admin who is logged in. - Route
/admin/creation: It is used by the admin who is logged in for creating a survey. It shows an ad hoc form to insert question and possible options (if MCQ). - Route
/admin/:id: It is used by the admin who is logged in. It shows all the answers received for a survey. The "id" is the id belonging to that survey.
-
GET
/api/surveys- Description: Retrieve the list of all surveys
- Request body: None
- Response:
200 OK(success) or500 Internal Server Error(generic error) - Response body: An array of Survey objects.
-
GET
/api/surveys/:id- Description: Retrieve the questions of a given survey
- Request parameters: id of a survey
- Request body: None
- Response:
200 OK(success) or500 Internal Server Error(generic error) - Response body: An object Survey containing the questions requested.
-
POST
/api/surveys/:id- Description: Create an answer for a given survey
- Request parameters: id of a survey
- Request body: surveyID, user, answers (JSON format)
- Response:
201 Created(success) or422 Unprocessable Entity(invalid request body) or503 Service Unavailable(generic error) - Response body: An object describing a series of answers.
-
GET
/api/admin- Description: Retrieve the list of all surveys for a given admin
- Request parameters: id of the user
- Request body: None
- Response:
200 OK(success) or500 Internal Server Error(generic error) - Response body: An array of survey objects.
-
GET
/api/admin/:id- Description: Retrieve the list of all answers for a given survey published by a given admin
- Request parameters: id of a survey
- Request body: None
- Response:
200 OK(success) or500 Internal Server Error(generic error) - Response body: An array of answer objects.
-
POST
/api/admin/creation- Description: Create a survey for a given admin
- Request parameters: id of the admin
- Request body: title of a survey, questions of a survey (JSON format)
- Response:
201 Created(success) or422 Unprocessable Entity(invalid request body) or503 Service Unavailable(generic error) - Response body: An object describing a survey.
-
POST
/api/session- Description: authenticate the admin who is trying to log in
- Request body: Username, password (JSON format)
- Response:
201 Created(success) or422 Unprocessable Entity(invalid request body) or503 Service Unavailable(generic error) - Response body: An object describing an admin.
-
GET
/api/session/current- Description: check if current user is logged in and get its data.
- Request body: None
- Response:
200 OK(success),404 Not Found(invalid email) or503 Service Unavailable(generic error) - Response body: Authenticated user.
-
DELETE
/api/session/current- Description: Logout
- Request body: None
- Response:
200 OK(success),404 Not Found(invalid email) or503 Service Unavailable(generic error) - Response body: A message of logging out.
- Table
admin- contains id, email, username, hash - Table
surveys- contains id, title, admin, questions - Table
answer- contains id, survey, user, answers
SurveyMgr(inApp.js): it acts as an intermediary between App and SurveyList.QuestionMgr(inApp.js): it acts as an intermediary between App and QuestionList.ViewMgr(inApp.js): it acts as an intermediary between App and ViewList.CreationMgr(inApp.js): it acts as an intermediary between App and CreationList.SurveyList(inContentList.js): Its functionality is to render the surveys in home page and admin page.QuestionList(inContentList.js): Its functionality is to render the questions in answering page.CreationList(inCreation.js): Its functionality is to render the page for creating a survey.ViewList(inContentList.js): Its functionality is to render the page viewing the survey's results.Navigation(inNavigation.js): It is used for rendering navbar.ModalForm(inModalForm.js): Its function is rendering the form for adding a question in a survey during its creation.LoginForm(inLogin.js): It is used for rendering login form.
- username: admin1@mysurvey.it, psw: password
- username: admin2@mysurvey.it, psw: password
- admin1: Survey1 (SPORT FLAVORS), Survey3 (CAR FLAVORS), Survey4 (PERSONAL INFORMATION)
- admin2: Survey2 (SCIENCE FLAVORS)
