Skip to content

Commit

Permalink
local server that supports wasm files
Browse files Browse the repository at this point in the history
  • Loading branch information
epugh committed Feb 9, 2024
1 parent 4883bba commit c0c4db1
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import http.server
import socketserver

PORT = 8080

class HttpRequestHandler(http.server.SimpleHTTPRequestHandler):
extensions_map = {
'': 'application/octet-stream',
'.manifest': 'text/cache-manifest',
'.html': 'text/html',
'.png': 'image/png',
'.jpg': 'image/jpg',
'.svg': 'image/svg+xml',
'.css': 'text/css',
'.js':'application/x-javascript',
'.wasm': 'application/wasm',
'.json': 'application/json',
'.xml': 'application/xml',
}

httpd = socketserver.TCPServer(("localhost", PORT), HttpRequestHandler)

try:
print(f"serving at http://localhost:{PORT}")
httpd.serve_forever()
except KeyboardInterrupt:
pass

0 comments on commit c0c4db1

Please sign in to comment.