Add initial version of nolabs website
diff --git a/app/api/tokens.py b/app/api/tokens.py
new file mode 100644
index 0000000..51fd9f4
--- /dev/null
+++ b/app/api/tokens.py
@@ -0,0 +1,18 @@
+from flask import jsonify, g
+from app import db
+from app.api import bp
+from app.api.auth import basic_auth, token_auth
+
+@bp.route('/tokens', methods=['POST'])
+@basic_auth.login_required
+def get_token():
+ token = g.current_user.get_token()
+ db.session.commit()
+ return jsonify({'token': token})
+
+@bp.route('/tokens', methods=['DELETE'])
+@token_auth.login_required
+def revoke_token():
+ g.current_user.revoke_token()
+ db.session.commit()
+ return '', 204