feat: add support for HTTPS with --pem option in both Python and Node.js servers

This commit is contained in:
2026-05-22 00:08:50 +02:00
parent c0237886ee
commit fca0b84216
3 changed files with 60 additions and 11 deletions
+5
View File
@@ -20,16 +20,21 @@ To run the server from the command line:
python3 ok-server.py
python3 ok-server.py --look basic
python3 ok-server.py --bind 127.0.0.1 --port 8080 --look tailwind
python3 ok-server.py --pem /path/to/bundle.pem --port 8443
```
`--look` accepts `basic`, `nice`, `bootstrap`, or `tailwind`.
You can override the look per request with the `look` query parameter, for example:
`http://localhost:8080/?look=tailwind`
`--pem` accepts a path to a PEM file containing the certificate chain and private key.
When provided, the server listens on HTTPS instead of plain HTTP.
```bash
node ok-server.mjs
node ok-server.mjs --look basic
node ok-server.mjs --bind 127.0.0.1 --port 8080 --look tailwind
node ok-server.mjs --pem /path/to/bundle.pem --port 8443
```
Connect to the server using a web browser or a tool like `curl`: