There are many ways that we can use to setup SSL/TLS to our Nodejs app. In this post we will forcus on tow of the main methods.
Setting SSL using Private key and Full Chain pem Certificate files
Mostly if you are using Linux based OS on your server , you will be mostly familier with private key pem and full chain pem certificate files for enabling SSL on web servers. For example when you generate a SSL certificate using Let’s Encrypt, it generate the above pem files for you.
Once you have obtained the private and fullchain pem files, you can enable SSL on your node app as follows:
hear the privateKey variable holds the path to the prive key pem file and fullchain variable holds the path to the fullchain pem file.
Setting SSL using PFX Certificate File
If you are using a windows based OS for your server, when you generate or get the SSL certificate file it wil be in PFX format (cert.pfx), So in this scenario you can use the following method to enable SSL on your Nodejs App:
How To Install Docker on Ubuntu
Update the apt package index and install packages to allow apt to use a repository over HTTPS: sudo apt-get update sudo apt-get install ca-certificates curl gnupg lsb-release Add
Javascript For Loops
Javascript For Loops in the ECMA Standard Simple For Loop The simplest type of for loop increments a variable as its iteration method. The variable