Normally, we don’t need to create SSL certificates when we develop locally.
We only need SSL certificates for this app because Facebook’s API complains if we don’t have one.
Creating a certificate
The easiest way to create a certificate is to use a command line tool called mkcert. I wrote about mkcert, how to use install it and how to use it in this article.
Below is a video showing you how to use mkcert for this starter project.
Running the server
Once you have the certs in place, you can use npm run server to start the project. This command simply runs nodemon server.js, so you can choose to use nodemon server.js if you wish to.
npm run serverAt this point you can navigate to https://localhost to see your project.
In the next lesson you’ll learn how to let users login with Github.
Quick note on HTTPS and Chrome
After you served https://localhost once, Chrome will begin to have a weird behaviour where it redirects you to the https protocol every single time.
This can be frustrating if you’re not using https on other projects.
Fixing this is simple.
- Go to
chrome://net-internals/#hstsin your address bar. - Input
localhostinto “Delete domain security policies” and press enter.
Welcome! Unfortunately, you don’t have access to this lesson. To get access, please purchase the course or enroll in Magical Dev School.
Unlock this lesson