/mkcert-reactjs-ssl

a React app using HTTPS for Local Development powered by mkcert 🔒

Primary LanguageJavaScript

Mkcert ReactJS - SSL 🔒

a React app using HTTPS for Local Development (localhost) powered by mkcert.


How to Run

  1. Clone this repo :
git clone https://github.com/kevinadhiguna/mkcert-reactjs-ssl.git

  1. Open Terminal and change directory to mkcert-reactjs-ssl :
cd mkcert-reactjs-ssl

  1. Install dependencies :
yarn

or

yarn install

Note: with npm, it would be :

npm install

  1. Run the React app :
yarn devStart

Note: with npm, it would be

npm run devStart

Runs the app in the development mode with HTTPS.
Open https://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.


Configuring HTTPS

Go to package.json and change the script to :

Windows

"scripts": {
  "devStart":
    "set HTTPS=true&&set SSL_CRT_FILE={CERT-PATH}&&set SSL_KEY_FILE={KEY-PATH}&&react-scripts start"
}

Linux & MacOS

"scripts": {
  "devSstart":
    "HTTPS=true SSL_CRT_FILE={CERT-PATH} SSL_KEY_FILE={KEY-PATH} react-scripts start"
}

Please replace {CERT-PATH} and {KEY-PATH} to yours. It will be generated after mkcert localhost command.


Acknowledgement


Hello !