Weekend Server Experiments with Node.js: Exploring `setTimeout`, HTTP/HTTPS, and Certificates

14/06/2025

Saturday morning, playing with servers—just doing some basic experimentation.

In this commit, I tested how setTimeout behaves when an error occurs during file reading. Most of the time, it runs after the poll and check phases—in the next cycle of the event loop.

🔗 View commit

In my lab, I added raw servers—one for HTTP and another for HTTPS. I also included corresponding clients for both protocols.

🔗 HTTP/HTTPS server and client commit
🔗 HTTPS client commit

For the HTTPS server, I needed to generate a self-signed certificate. Here's the commit and the OpenSSL commands I used:

🔗 Certificate creation commit

# Create a private key
openssl genrsa -out private-key.pem 2048

# Create a certificate and self-sign it with the private key
openssl req -new -x509 -key private-key.pem -out certificate.pem -days 365

`