Initial commit: Carrot Hunter v2 with 20 levels
This commit is contained in:
21
start_server.py
Executable file
21
start_server.py
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python3
|
||||
import http.server
|
||||
import socketserver
|
||||
from functools import partial
|
||||
|
||||
class CORSRequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||
def end_headers(self):
|
||||
self.send_header('Access-Control-Allow-Origin', '*')
|
||||
self.send_header('Access-Control-Allow-Methods', 'GET')
|
||||
self.send_header('Cache-Control', 'no-store, no-cache, must-revalidate')
|
||||
super().end_headers()
|
||||
|
||||
PORT = 8080
|
||||
handler = partial(CORSRequestHandler, directory='/home/alex/git/carrot/Carrot_Hunter')
|
||||
|
||||
print(f"\n✓ Server kører på http://localhost:{PORT}")
|
||||
print(f"✓ Åbn: http://localhost:{PORT}/index.html")
|
||||
print(f"✓ Med CORS headers aktiveret\n")
|
||||
|
||||
with socketserver.TCPServer(("", PORT), handler) as httpd:
|
||||
httpd.serve_forever()
|
||||
Reference in New Issue
Block a user