Install Node.js (LTS) directly from https://nodejs.org/en/ or via your favorite tool (nvm, homebrew, etc.)
- Install dependencies
npm install
- Run frontend app
npm run dev:client
- Run backend app (in a separate terminal tab/window)
npm run dev:server
- Go to http://localhost:1234
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Headers', 'Origin, Content-Type, Accept');
In order to create a HTTPS server with self-signed certificate you need to:
- Generate key and certificate pair locally (note that output path for both of them is set here):
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./selfsigned.key -out selfsigned.crt
-
Put
key
andcrt
files into ./ssl folder -
Set up a HTTPS server:
See server-https.js
node src/server-https.js
- Ensure you chose to allow self-signed certificated on localhost in Chrome:
chrome://flags/#allow-insecure-localhost
- Go to https://localhost:8001