Problem Statement
How do you enable HTTPS in Node.js?
Explanation
Node’s `https` module lets you create secure servers using SSL/TLS certificates. HTTPS ensures encrypted communication between clients and servers, preventing eavesdropping and data tampering.
Code Solution
SolutionRead Only
const https=require('https');
const fs=require('fs');
const opts={key:fs.readFileSync('key.pem'),cert:fs.readFileSync('cert.pem')};
https.createServer(opts,(req,res)=>res.end('Secure!')).listen(443);