def create(resources):
"""create a new resource"""
if resources not in app.resources:
abort(404, "Not Found")
new_data = dict.fromkeys(app.resources[resources]["model"].keys())
for key in new_data:
if key in request.json:
new_data[key] = request.json.get(key)
new_data['id'] = uuid.uuid4().__str__()
app.data[resources][new_data['id']] = new_data
return new_data
评论列表
文章目录