Skip to content
Snippets Groups Projects
Commit 1597f233 authored by Joseph Weston's avatar Joseph Weston
Browse files

add docstrings to API

docstrings will be our documentation. This is better
than a separate file, as it does not need to be edited separately
from the code.
parent a8d0a22f
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,16 @@ app = Blueprint(__name__, __name__)
@app.route('/graders', methods=['GET'])
@db.session
def get_graders():
"""get all graders.
Returns
-------
list of:
id: int
first_name: str
last_name: str
"""
return jsonify([
dict(id=g.id, first_name=g.first_name, last_name=g.last_name)
......@@ -22,6 +32,19 @@ def get_graders():
@app.route('/graders', methods=['POST'])
@db.session
def post_graders():
"""add a grader.
Parameters
----------
first_name: str
last_name: str
Returns
-------
id: int
first_name: str
last_name: str
"""
grader_spec = request.get_json(silent=False, force=True)
try:
new_grader = db.Grader(first_name=grader_spec['first_name'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment