Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Travis Dula - all three #85

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

Conversation

travisdula
Copy link

I learned a lot to do these, and I learned that I have much more to learn. Let me know if you have any questions about my design decisions!

data_list = []

# TODO: better (more verbose) errors
@app.route('/data', methods=['GET', 'POST', 'PATCH'])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did you decide on what methods are appropriate here? For example would it make sense to include PUT or DELETE?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to implement only the requested methods, but with the current model I don't think PUT makes sense. If we had given the ability to create multiple data records, then PUT would be used to create new ones or overwrite existing ones. DELETE could be used in the current model to remove the only list.

try:
data_list = list(sorted([int(request.data)] + data_list))
return jsonify(data_list)
except BaseException as e:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did you decide that BaseException is the correct exception to use?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not ideal to handle exceptions in this manner, but I also cannot think of a situation in which it will behave in an unintended manner. I do notice now though that I didn't do sufficient testing with floats, because those won't work properly here.

@FaisalAlnahhas
Copy link

Hi,

This is Faisal from Headstorm. I looked at your PR and left you a couple of questions to understand your thought process. Good work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants