I have create an API using Express in Node JS, and before, I use http
const server = http.createServer(app);
and it worked fine, no issue at all.
But I tried using https because to make it more secure. I've defined the options with paths to my certificate and secret key
const options = {
key: fs.readFileSync('./key.key'),
cert: fs.readFileSync('./cert.crt')
};
const server = https.createServer(options, app);
But when I tried to send a request, it keeps loading, and eventually after come minutes, it gives me request timeout. This is the screenshot of the loading when I send a request.
Can someone please help me? Oh, when I visit the page with my browser, this is what it returned after the long pending. Notes that the page is already using the ssl certificate.
I have tried modify the certificate, assuming that it doesn't work because my certificate is not valid, but it returns an error instead of giving me request timeout. So, I my certificate and my secret key is not the issue here.