2020年5月23日 • ☕️ 2 min read
English

Service Workerをローカルでテストする場合、localhostでhttps化への手順の整理。

chocolateyのインストール

PowerShellを管理権限で起動し、下記のコマンドを実行してください。

run-powershell-admin.png

Copy
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'))

参考リンク:https://chocolatey.org/install

mkcertのインストール

Copy
choco install mkcert

証明書生成

Copy
mkcert localhost

http-serverでサーバを立ち上げる(nodejsが必要)

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

完了

https://localhost:8080/にアクセスできました。

サンプルプロジェクト

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


関連投稿

nodemailerでgmailのアカウントを利用して送信する

2020年6月13日

vagrant boxのnodejs、React開発環境

2018年2月24日

ThunderMiracle

Blog part of ThunderMiracle.com