Skip to content

Commit

Permalink
chore: Fixed api route
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmbiya committed Oct 14, 2020
1 parent f6de261 commit 99fbd48
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
def index():
return "Hello, World!"

@app.route('/mfrc522/api/v1/read')
@app.route('/mfrc522/api/read')
def read_card():
reader = SimpleMFRC522()
dataObject = {}
Expand All @@ -24,14 +24,14 @@ def read_card():
GPIO.cleanup()
return jsonify(dataObject)

@app.route('/mfrc522/api/v1/write/<data>')
@app.route('/mfrc522/api/write/<data>')
def write_card(data):
reader = SimpleMFRC522()
dataObject = {}
try:
id, text = reader.read()
reader.write(data)
dataObject = {'id':id, 'data':text}
dataObject = {'id':id, 'data':data}
finally:
GPIO.cleanup()
return jsonify(dataObject)
Expand Down

0 comments on commit 99fbd48

Please sign in to comment.