skia2/tools/serve_wasm.py
Kevin Lubick f32ad08ac4 [infra] Deduplicate serve.py
Change-Id: I25bd987faedd7e9c322bcec487ab07583bad6b9a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458197
Reviewed-by: Erik Rose <erikrose@google.com>
2021-10-12 11:42:50 +00:00

24 lines
605 B
Python

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