From b32ef2082c463d3df9ef03b1247492aa6c9266f7 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 11 Jun 2026 13:17:29 +0000 Subject: [PATCH] Add Vercel project with health check ping Static frontend + Python serverless function at /api/ping that sends a GET request to Healthchecks.io and returns JSON status. https://claude.ai/code/session_01U8j5zqsX4kwqjnzq3EncSi --- api/ping.py | 24 ++++++++++++++++++++++++ index.html | 40 ++++++++++++++++++++++++++++++++++++++++ vercel.json | 5 +++++ 3 files changed, 69 insertions(+) create mode 100644 api/ping.py create mode 100644 index.html create mode 100644 vercel.json diff --git a/api/ping.py b/api/ping.py new file mode 100644 index 0000000..6adae02 --- /dev/null +++ b/api/ping.py @@ -0,0 +1,24 @@ +import socket +import urllib.request +from http.server import BaseHTTPRequestHandler + +PING_URL = "https://hc-ping.com/4f9a5abf-38d6-4f34-a698-9e97c3a62632" + + +def do_ping(): + try: + urllib.request.urlopen(PING_URL, timeout=10) + return {"status": "ok", "message": "Ping sent successfully"} + except socket.error as e: + return {"status": "error", "message": f"Ping failed: {e}"} + + +class handler(BaseHTTPRequestHandler): + def do_GET(self): + result = do_ping() + body = str(result).encode() + self.send_response(200) + self.send_header("Content-Type", "application/json") + self.end_headers() + import json + self.wfile.write(json.dumps(result).encode()) diff --git a/index.html b/index.html new file mode 100644 index 0000000..c064bda --- /dev/null +++ b/index.html @@ -0,0 +1,40 @@ + + + + + + Health Check Ping + + + +

Health Check Ping

+

Clique no botão para enviar um ping ao Healthchecks.io.

+ +
+ + + + diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..60d55a0 --- /dev/null +++ b/vercel.json @@ -0,0 +1,5 @@ +{ + "rewrites": [ + { "source": "/api/ping", "destination": "/api/ping.py" } + ] +}