header background image

Startup https://localhost:8080 in Windows in 5 minutes

2020年5月23日☕️ 1 min read

For testing Service Worker in local Windows machine, we need startup a https server: https://localhost:8080. Let's do this job in 5 minutes.

Install chocolatey

Start PowerShell in administrator and run following command.

run-powershell-admin.png

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

See chocolatey manual: https://chocolatey.org/install

Install mkcert

choco install mkcert

Generate ssl cert for localhost

mkcert localhost

Startup https://localhost:8080 by http-server (nodejs is required)

npm i -g http-server
http-server ./ -S -K ./localhost-key.pem -C ./localhost.pem

That's all

You can now access https://localhost:8080/ and test your Service Worker.

Example Project

https://github.com/thundermiracle/try-scheduled-push

ThunderMiracle

Blog part of ThunderMiracle.com

Comments load when in view