For node.js you need to run letsencrypt in manual mode and then add the certificates to your code.
The following command will download letsencrypt and generate your certificates. Modify with your domain name and email address.
git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
./letsencrypt-auto certonly --manual --email admin@example.com -d example.com
Letsencrypt will create a directory containing four files. In the following example, the file fullchain.pem is not used. Read the documentation for details on each file.
Location: /etc/letsencrypt/live/example.com
Note: Read the output from letsencrypt for the actual file location
Example node.js:
var https = require('https');
var fs = require('fs');
var options = {
key: fs.readFileSync('/etc/letsencrypt/live/example.com/privkey.pem'),
cert: fs.readFileSync('/etc/letsencrypt/live/example.com/cert.pem'),
ca: fs.readFileSync('/etc/letsencrypt/live/example.com/chain.pem')
};
https.createServer(options, function (req, res) {
res.writeHead(200);
res.end("hello world\n");
}).listen(8443);
Test with a web browser to https://example.com:8443/