GoogleChromeLabs / airhorn

Air horn
https://airhorner.com/
Other
365 stars 188 forks source link

Add simple express server #38

Closed 0livare closed 5 years ago

0livare commented 6 years ago

The python server suggested in the tutorial serves the sw.js service worker file (the crux of this tutorial) with a content-type=text/plain header instead of the required content-type=application/json; charset=UTF-8. This causes chrome to give an error:

DOMException: Failed to register a ServiceWorker: The script has an unsupported MIME type ('text/plain').

I have added a very simple express server to this repo that fixes that issue by serving the file with the proper content-type.

PaulKinlan commented 5 years ago

Sorry for the delay in replying. I think this can be acheived instead by the serve module, which we could inlcude as a devDep rather than implementing an entire in the code.

Thank you for the support though!