2021-08-31 14:21:57 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# Copyright 2018 Google LLC
|
|
|
|
#
|
2020-04-24 19:06:19 +00:00
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
2021-10-11 19:47:47 +00:00
|
|
|
#
|
|
|
|
# This is a simple webserver that applies the correct MIME type for .wasm files.
|
2020-04-24 19:06:19 +00:00
|
|
|
|
2021-08-31 14:21:57 +00:00
|
|
|
import http.server
|
|
|
|
import socketserver
|
2020-04-24 19:06:19 +00:00
|
|
|
|
2021-08-31 14:21:57 +00:00
|
|
|
PORT = 8000
|
2020-04-24 19:06:19 +00:00
|
|
|
|
2021-08-31 14:21:57 +00:00
|
|
|
class Handler(http.server.SimpleHTTPRequestHandler):
|
2020-04-24 19:06:19 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
Handler.extensions_map['.js'] = 'application/javascript'
|
|
|
|
# Without the correct MIME type, async compilation doesn't work
|
|
|
|
Handler.extensions_map['.wasm'] = 'application/wasm'
|
|
|
|
|
2021-08-31 14:21:57 +00:00
|
|
|
httpd = socketserver.TCPServer(("", PORT), Handler)
|
2020-04-24 19:06:19 +00:00
|
|
|
|
|
|
|
httpd.serve_forever()
|