change methods names

master
gtitov 4 years ago
parent f48a7a8443
commit 7fa10a715a

@ -1,10 +1,23 @@
from fastapi import FastAPI from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware # CORS
import json import json
import random import random
from pathlib import Path from pathlib import Path
app = FastAPI() app = FastAPI()
origins = [ # CORS
"*",
]
app.add_middleware( # CORS
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# student_answers_example = { # student_answers_example = {
# "version": 1, # "version": 1,
# "student": "asd", # "student": "asd",
@ -50,9 +63,9 @@ def check_answers(student_answers: dict):
def show_students(): def show_students():
return students return students
@app.get("/give_quiz") @app.get("/get_quiz")
def give_quiz(student_id, student: str): def get_quiz(student_id, student: str):
"""Give json-like quiz """Get json-like quiz
Args: Args:
student_id (int): indentificator of a student student_id (int): indentificator of a student
@ -71,8 +84,8 @@ def give_quiz(student_id, student: str):
"questions": questions_for_student "questions": questions_for_student
} }
@app.get("/get_student_answers") @app.get("/send_student_answers")
def get_answers(student_answers: str): def send_student_answers(student_answers: str):
"""Save answers as-is and checked answers """Save answers as-is and checked answers
Args: Args: