Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
serve_wasm.py
Go to the documentation of this file.
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
9import http.server
10import socketserver
11
12PORT = 8000
13
14class Handler(http.server.SimpleHTTPRequestHandler):
15 pass
16
17Handler.extensions_map['.js'] = 'application/javascript'
18# Without the correct MIME type, async compilation doesn't work
19Handler.extensions_map['.wasm'] = 'application/wasm'
20
21httpd = socketserver.TCPServer(("", PORT), Handler)
22
23httpd.serve_forever()