init
This commit is contained in:
0
flask_demo_api/routers/__init__.py
Normal file
0
flask_demo_api/routers/__init__.py
Normal file
42
flask_demo_api/routers/key.py
Normal file
42
flask_demo_api/routers/key.py
Normal file
@@ -0,0 +1,42 @@
|
||||
from flask import Blueprint, jsonify, request
|
||||
|
||||
key_bp = Blueprint("key_bp", __name__)
|
||||
|
||||
|
||||
@key_bp.route("/", methods=["POST"])
|
||||
def past_key():
|
||||
json_data = request.get_json()
|
||||
|
||||
if json_data:
|
||||
return (
|
||||
jsonify({"message": "Received JSON data successfully", "data": json_data}),
|
||||
200,
|
||||
)
|
||||
else:
|
||||
return jsonify({"message": "No JSON data received"}), 400
|
||||
|
||||
|
||||
@key_bp.route("/", methods=["GET"])
|
||||
def get_key():
|
||||
json_data = request.args.get("key")
|
||||
|
||||
if json_data:
|
||||
return (
|
||||
jsonify({"message": "Received JSON data successfully", "data": json_data}),
|
||||
200,
|
||||
)
|
||||
else:
|
||||
return jsonify({"message": "No JSON data received"}), 400
|
||||
|
||||
|
||||
@key_bp.route("/", methods=["PUT"])
|
||||
def put_key():
|
||||
json_data = request.get_json()
|
||||
|
||||
if json_data:
|
||||
return (
|
||||
jsonify({"message": "Received JSON data successfully", "data": json_data}),
|
||||
200,
|
||||
)
|
||||
else:
|
||||
return jsonify({"message": "No JSON data received"}), 400
|
Reference in New Issue
Block a user