Last active
March 22, 2026 22:41
-
-
Save CostaFot/e81ea3b67115f752b170691f42a04c4b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @app.route("/claps", methods=["GET"]) | |
| def get_claps(): | |
| data, _ = get_claps_file() | |
| key = normalise_url(request.args.get("url")) | |
| return jsonify({"claps": data.get(key, 0)}) | |
| @app.route("/claps", methods=["POST"]) | |
| def add_clap(): | |
| data, sha = get_claps_file() | |
| key = normalise_url(request.args.get("url")) | |
| data[key] = data.get(key, 0) + 1 | |
| save_claps_file(data, sha) | |
| return jsonify({"claps": data[key]}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment