| 1 |
#!/usr/bin/env python3 |
| 2 |
# Copyright 2018 Google LLC |
| 3 |
# |
| 4 |
# Use of this source code is governed by a BSD-style license that can be |
| 5 |
# found in the LICENSE file. |
| 6 |
# |
| 7 |
# This is a simple webserver that applies the correct MIME type for .wasm files. |
| 8 |
|
| 9 |
import http.server |
| 10 |
import socketserver |
| 11 |
|
| 12 |
PORT = 8000 |
| 13 |
|
| 14 |
class Handler(http.server.SimpleHTTPRequestHandler): |
| 15 |
pass |
| 16 |
|
| 17 |
Handler.extensions_map['.js'] = 'application/javascript' |
| 18 |
# Without the correct MIME type, async compilation doesn't work |
| 19 |
Handler.extensions_map['.wasm'] = 'application/wasm' |
| 20 |
|
| 21 |
httpd = socketserver.TCPServer(("", PORT), Handler) |
| 22 |
|
| 23 |
httpd.serve_forever() |