def all_courses(): # print (request.headers) courses = Course.get_all() # course = Course.query.get_or_404(1)('01') data = courses_schema.dump(courses).data # res.headers.add('Access-Control-Allow-Origin', '*') return data
def get_courses(): courses = Course.get_all() result = [] for course in courses: obj = { "id": course.id, "courseName": course.courseName, "author": course.author, "limit": course.limit, } result.append(obj) response = jsonify(result) response.status_code = 200 return response