Tripagra
Add test endpoint to verify Python functions work
3891b84
Raw
History Blame Contribute Delete
880 Bytes
"""
Simple test endpoint to verify Python functions work on Vercel
"""
from http.server import BaseHTTPRequestHandler
import json
class handler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-Type', 'application/json')
self.send_header('Access-Control-Allow-Origin', '*')
self.end_headers()
response = {
"message": "Hello from Python serverless function!",
"status": "working"
}
self.wfile.write(json.dumps(response).encode('utf-8'))
def do_OPTIONS(self):
self.send_response(200)
self.send_header('Access-Control-Allow-Origin', '*')
self.send_header('Access-Control-Allow-Methods', 'GET, OPTIONS')
self.send_header('Access-Control-Allow-Headers', 'Content-Type')
self.end_headers()