generated from mwc/lab_server
chkpt2
This commit is contained in:
parent
f5cd69eb69
commit
e0cd665098
4
notes.md
4
notes.md
|
@ -25,10 +25,10 @@ Maybe testing a server before making it public. I cannot think of any other reas
|
|||
program's behavior. Describe a few routes which you think may exist for your
|
||||
chosen program's backend server.
|
||||
|
||||
|
||||
I chose google docs. It might use a post for login purposes. It might use a get to obtain all of your files on the home page. It might use a post for updating text on documents.
|
||||
|
||||
4. In your own words, what is an exception? When might it be useful to handle an
|
||||
exception? When is it better not to handle an exception, and instead let the
|
||||
program crash?
|
||||
|
||||
|
||||
An exception is when something irregular happens in your code that it normally would not know how to deal with it. It might be useful to handle an exception to try to get the user back on the right track. It migh be better to let the program crash if the user is trying to do something that would break your program or harm privacy.
|
||||
|
|
|
@ -2,7 +2,7 @@ from banjo.urls import route_get, route_post
|
|||
from banjo.http import BadRequest, NotFound
|
||||
from app.models import Riddle
|
||||
|
||||
@route_get('all', args={})
|
||||
@route_get('apple', args={})
|
||||
def list_riddles(params):
|
||||
riddles = sorted(Riddle.objects.all(), key=lambda riddle: riddle.difficulty())
|
||||
return {'riddles': [riddle.to_dict(with_answer=False) for riddle in riddles]}
|
||||
|
|
Loading…
Reference in New Issue