#!/usr/bin/env python3
import http.server, socketserver, os, sys

PORT = 28321
os.chdir(os.path.dirname(os.path.abspath(__file__)))

class H(http.server.SimpleHTTPRequestHandler):
    extensions_map = {**http.server.SimpleHTTPRequestHandler.extensions_map,
                      '.csv': 'text/csv',
                      '.html': 'text/html'}
    def log_message(self, fmt, *args):
        sys.stderr.write("[server] %s\n" % (fmt % args))

socketserver.TCPServer.allow_reuse_address = True
with socketserver.TCPServer(("127.0.0.1", PORT), H) as httpd:
    print(f"Serving on http://127.0.0.1:{PORT}/poc.html", flush=True)
    httpd.serve_forever()
