Skip to content

Instantly share code, notes, and snippets.

@JohnL4
Created September 23, 2020 14:59
Show Gist options
  • Save JohnL4/7fbfb5de9bd330dd6d5cb84a2014074f to your computer and use it in GitHub Desktop.
Save JohnL4/7fbfb5de9bd330dd6d5cb84a2014074f to your computer and use it in GitHub Desktop.
Use Python to simply server files from local dir, giving javascript the correct MIME type.
# Use to create local host, server javascript modules w/the correct mimetime.
# See https://stackoverflow.com/a/60638762
#
import http.server
import socketserver
PORT = 8080
Handler = http.server.SimpleHTTPRequestHandler
Handler.extensions_map.update({
".js": "application/javascript",
})
httpd = socketserver.TCPServer(("", PORT), Handler)
httpd.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment