Untitled
unknown
plain_text
a year ago
748 B
34
Indexable
import http.server
import socketserver
import json
from urllib.parse import urlparse, parse_qs
mock_db = {
"users": [
{"id": 1, "name": "Alice", "email": "alice@example.com"},
{"id": 2, "name": "Bob", "email": "bob@example.com"},
{"id": 3, "name": "Charlie", "email": "charlie@example.com"}
],
"products": [
{"id": 1, "name": "Laptop", "price": 999.99},
{"id": 2, "name": "Smartphone", "price": 499.99},
{"id": 3, "name": "Headphones", "price": 99.99}
]
}
class MyServer(http.server.SimpleHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-type','text/html')
self.end_headers()
self.wfile.write(b'Hello, World!')
Editor is loading...
Leave a Comment