Our team project was to build a survey appliction. Ours app is very basic one where each survey has only 1 question. A user must be signed in before they can create/view/modify their surveys. Once the survey has been created, a generated url is created that can be used by anyone to take the survey. All responses for a survey can be viewed by the survey owner.
- survey-express-api (githup): https://github.com/push-it-real-good/survey-express-api
- survey-express-api (heroku): https://floating-savannah-15725.herokuapp.com/
- survey-client (github): https://github.com/push-it-real-good/survey-client
- survey-client app: https://push-it-real-good.github.io/survey-client/
Verb | URI Pattern | Controller#Action |
---|---|---|
POST | /sign-up |
users#signup |
POST | /sign-in |
users#signin |
PATCH | /change-password/:id |
users#changepw |
DELETE | /sign-out/:id |
users#signout |
Request:
curl http://localhost:4741/sign-up \
--include \
--request POST \
--header "Content-Type: application/json" \
--data '{
"credentials": {
"email": "'"${EMAIL}"'",
"password": "'"${PASSWORD}"'",
"password_confirmation": "'"${PASSWORD}"'"
}
}'
Request:
curl http://localhost:4741/sign-in \
--include \
--request POST \
--header "Content-Type: application/json" \
--data '{
"credentials": {
"email": "'"${EMAIL}"'",
"password": "'"${PASSWORD}"'"
}
}'
Request:
curl --include --request PATCH "http://localhost:4741/change-password/$ID" \
--header "Authorization: Token token=$TOKEN" \
--header "Content-Type: application/json" \
--data '{
"passwords": {
"old": "'"${OLDPW}"'",
"new": "'"${NEWPW}"'"
}
}'
Request:
curl http://localhost:4741/sign-out/$ID \
--include \
--request DELETE \
--header "Authorization: Token token=$TOKEN"
Verb | URI Pattern | Controller#Action |
---|---|---|
GET | /surveys/:id |
surveys#show |
GET | /surveys |
surveys#index |
POST | /surveys |
surveys#create |
PATCH | /surveys/:id |
surveys#update |
DELETE | /surveys/:id |
surveys#destroy |
Request:
curl "${API}${URL_PATH}/${ID}" \
--include \
--request GET \
--header "Authorization: Token token=$TOKEN"
curl "${API}${URL_PATH}" \
--include \
--request GET \
--header "Authorization: Token token=$TOKEN"
Request:
curl "${API}${URL_PATH}" \
--include \
--request POST \
--header "Content-Type: application/json" \
--header "Authorization: Token token=${TOKEN}" \
--data '{
"survey": {
"title": "'"${TITLE}"'",
"question": "'"${QUESTION}"'"
}
}'
Request:
curl "${API}${URL_PATH}/${ID}" \
--include \
--request PATCH \
--header "Content-Type: application/json" \
--header "Authorization: Token token=${TOKEN}" \
--data '{
"survey": {
"title": "'"${TITLE}"'",
"question": "'"${QUESTION}"'"
}
}'
Request:
curl "${API}${URL_PATH}/${ID}" \
--include \
--request DELETE \
--header "Authorization: Token token=${TOKEN}"
Verb | URI Pattern | Controller#Action |
---|---|---|
GET | /responses |
responses#index |
POST | /responses |
responses#create |
DELETE | /responses/:id |
responses#destroy |
Request:
curl "${API}${URL_PATH}" \
--include \
--request GET \
--header "Content-Type: application/json" \
--header "Authorization: Token token=$TOKEN" \
--data '{
"survey_id": "'"${SURVEYID}"'"
}'
Request:
curl "${API}${URL_PATH}" \
--include \
--request POST \
--header "Content-Type: application/json" \
--data '{
"response": {
"text": "'"${TEXT}"'",
"survey_id": "'"${SURVEYID}"'"
}
}'
Request:
curl "${API}${URL_PATH}/${ID}" \
--include \
--request DELETE \
--header "Content-Type: application/json" \
--header "Authorization: Token token=$TOKEN" \
--data '{
"survey_id": "'"${SURVEYID}"'"
}'
- All content is licensed under a CCBYNCSA 4.0 license.
- All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact [email protected].