Sometimes you need to run your app locally and use HTTPS. Below are steps that worked for me.
npm i -g http-server
Create a local certificate and key
openssl req -x509 -out localhost.crt -keyout localhost.key -newkey rsa:2048 -nodes -sha256 -subj '/CN=localhost' -extensions EXT -config (printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth" | psub)
Then you can run the server providing the path to your newly created certificate and key files.
http-server -S -C localhost.crt -K localhost.key
Assuming the server started with no issues you can now access https://127.0.0.1:8080/
You'll get a warning as it's an unsecure certificate but click on Proceed and you are off to the races.