To know if a request is http or https in Node.js, we use the req.secure property.
For instance, we write
const isSecure = req.secure;
to check if the request is secure with the req.secure property.
If it’s true, then the request is made via https.