Backend delpoyed at Heroku: https://tech-sorting-hat.herokuapp.com
Staging environment delpoyed at Heroku: https://staging-tech-sorting-hat.herokuapp.com
To get the server running locally:
- Clone this repo
- yarn install to install all required dependencies
- yarn run server to start the local server
- yarn test to start server using testing environment
This framework was chosen for the following reasons:
- built on Chrome's JavaScript runtime which is convenient as Javascript is the only choice to develop new web applications in the web browser.
- adding/changing functionality is easy as changes to the source code aren't needed.
- lightweight as its executions are a series of asynchronous callback.
- good to learn to understand and build on existing applications that use NodeJS
Method | Endpoint | Access Control | Description |
---|---|---|---|
GET | /api/questions |
all users | Returns all the questions for the quiz. |
GET | /api/questions/:id |
all users | Retrieve an existing question. |
POST | /api/questions |
admin | Create a question. |
PUT | /api/questions/:id |
admin | Modify an existing question. |
DELETE | /api/questions/:id |
admin | Delete an existing question. |
Method | Endpoint | Access Control | Description |
---|---|---|---|
GET | /api/answers |
all users | Returns answers for all the questions of the quiz. |
GET | /api/answers/:id |
all users | Returns a specific answer by its ID. |
GET | /api/answers/questions/:questionId |
all users | Returns all answers associated with that question. |
POST | /api/answers/questions/:questionId |
admin | Create an answer for a specific question. |
PUT | /api/answers/:id |
admin | Update a specific answer. |
DELETE | /api/answers/:id |
admin | Delete a specific answer. |
Method | Endpoint | Access Control | Description |
---|---|---|---|
GET | /api/tracks |
all users | Returns all the tracks and the corresponding points per answer choice. |
GET | /api/tracks/:id |
all users | Returns a track based on its ID. |
POST | /api/tracks |
admin | Creates a new track. |
PUT | /api/tracks/:id |
admin | Modify an existing track. |
DELETE | /api/tracks/:id |
admin | Delete an existing track. |
Method | Endpoint | Access Control | Description |
---|---|---|---|
GET | /api/points |
all users | Returns all the points of each track associated with each answer choice. |
GET | /api/points/:answerId |
all users | Returns a points associated with an asnwer choice. |
POST | /api/points |
admin | Creates a new track. |
PUT | /api/points/:id |
admin | Modify an existing track. |
DELETE | /api/points/:id |
admin | Delete an existing track. |
GET
/api/questions
returns :
[
{
"question": "Ultrices neque ullamcorper, arcu luctus, sapien congue amet elit nibh?",
"id": 1
},
{
"question": "Lorem ipsum dolor sit amet, wisi eget dolor montes nulla odio, nonummy est parturient quis parturient amet?",
"id": 2
}
]
GET
/api/questions/:id
returns :
{
"id": 1,
"question": "Ultrices neque ullamcorper, arcu luctus, sapien congue amet elit nibh?"
}
POST
/api/questions
input sample:
{
"question": "Sample question goes here"
}
PUT
/api/questions/:id
input sample:
{
"question": "Updated sample question goes here"
}
GET
/api/answers
returns :
[
{
"choice": "Nulla et pellentesque, facilisis pede",
"id": 1,
"question_id": 1
},
{
"choice": "This is an answer to the question",
"id": 2,
"question_id": 1
}
]
GET
/api/answers/:id
returns :
{
"id": 1,
"choice": "Nulla et pellentesque, facilisis pede",
"question_id": 1
}
GET
/api/answers/questions/:questionId
returns :
[
{
"id": 1,
"choice": "Nulla et pellentesque, facilisis pede",
"question_id": 1
},
{
"id": 2,
"choice": "This is an answer to the question",
"question_id": 1
}
]
POST
/api/answers/questions/:questionId
input sample:
{
"choice": "Write a possible answer to a question here"
}
PUT
/api/answers/:id
input sample:
{
"choice": "Update an existing answer here"
}
GET
/api/tracks
returns:
[
{
"id": 1,
"name": "UX Design",
"description": "UX Designers are focused on the user . . .",
"shortDesc": "Design great experiences for users",
"link": "placeholder.com",
"strengths": "You enjoy talking with people . . .",
"toggle": true
},
{
"id": 2,
"name": "Full Stack",
"description": "Full Stack Developers are able to . . .",
"shortDesc": "Create anything on the internet",
"link": "https://lambdaschool.com/courses/full-stack-web-development",
"strengths": "You are a bit of an introvert and enjoy close friends . . .",
"toggle": true
}
]
GET
/api/tracks/:id
returns:
{
"id": 1,
"name": "UX Design",
"description": "UX Designers are focused on the user . . .",
"shortDesc": "Design great experiences for users"
"link": "placeholder.com",
"strengths": "You enjoy talking with people . . .",
"toggle": true
}
POST
/api/tracks
input sample:
{
"name": "New Track",
"description": "This is fullstack track description",
"shortDesc": "short description of the track"
"link": "putOptionalLinkHere.com",
"strengths": "You enjoy talking with people . . .",
}
PUT
/api/tracks/:id
input sample:
{
"name": "android",
"description": "Update track description",
"shortDesc": "Update short description of the track",
"link": "putOptionalLinkHere.com",
"strengths": "You enjoy talking with people . . .",
"toggle": true
}
GET
/api/points
returns:
[
{
"points": "4.30",
"answer_id": 1,
"track_id": 1
},
{
"points": "2.30",
"answer_id": 1,
"track_id": 2
}
]
GET
/api/points/:answerId
returns:
[
{
"points": "4.30",
"answer_id": 1,
"track_id": 1
},
{
"points": "2.30",
"answer_id": 1,
"track_id": 2
}
]
find()
-> Returns all questions/answers/tracks/points, depending from which model it's imported from
findById(id)
-> Returns a question/answer/track/point by its ID, depending from which model it's imported from
In order for the app to function correctly, the user must set up their own environment variables.
create a .env file that includes the following:
* PORT - Choose a port for the API to run
* NODE_ENV - Have this set to the development environment for the deployed database to read
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
Please note we have a code of conduct. Please follow it in all your interactions with the project.
If you are having an issue with the existing project code, please submit a bug report under the following guidelines:
- Check first to see if your issue has already been reported.
- Check to see if the issue has recently been fixed by attempting to reproduce the issue using the latest master branch in the repository.
- Create a live example of the problem.
- Submit a detailed bug report including your environment & browser, steps to reproduce the issue, actual and expected outcomes, where you believe the issue is originating from, and any potential solutions you have considered.
We would love to hear from you about new features which would improve this app and further the aims of our project. Please provide as much detail and information as possible to show us why you think your new feature should be implemented.
If you have developed a patch, bug fix, or new feature that would improve this app, please submit a pull request. It is best to communicate your ideas with the developers first before investing a great deal of time into a pull request to ensure that it will mesh smoothly with the project.
Remember that this project is licensed under the MIT license, and by submitting a pull request, you agree that your work will be, too.
- Ensure any install or build dependencies are removed before the end of the layer when doing a build.
- Update the README.md with details of changes to the interface, including new plist variables, exposed ports, useful file locations and container parameters.
- Ensure that your code conforms to our existing code conventions and test coverage.
- Include the relevant issue number, if applicable.
- You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you.
These contribution guidelines have been adapted from this good-Contributing.md-template.
See Frontend Documentation for details on the frontend of our project.
Team Email
Account: [email protected]
Password: LambdaLabs22.
Heroku Account for Tech Sorting Hat BE
Name: Tech Sorting Hat
Email: [email protected]
Password: LambdaLabs22.