zero-http 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -179,15 +179,25 @@ app.get('/debug/routes', (req, res) =>
179
179
  res.send(JSON.stringify(app.routes(), null, 2));
180
180
  });
181
181
 
182
+ // --- TLS Certificates (HTTPS + WSS) ---
183
+ const certPath = '/www/server/panel/vhost/cert/z-http.com/fullchain.pem';
184
+ const keyPath = '/www/server/panel/vhost/cert/z-http.com/privkey.pem';
185
+ const hasCerts = fs.existsSync(certPath) && fs.existsSync(keyPath);
186
+
187
+ const tlsOpts = hasCerts
188
+ ? { cert: fs.readFileSync(certPath), key: fs.readFileSync(keyPath) }
189
+ : undefined;
182
190
 
183
191
  // --- Server Startup ---
184
- const port = process.env.PORT || 3000;
185
- const server = app.listen(port, () =>
192
+ const port = process.env.PORT || 7273;
193
+ const server = app.listen(port, tlsOpts, () =>
186
194
  {
187
- console.log(`zero-http full-server listening on http://localhost:${port}`);
195
+ const proto = hasCerts ? 'https' : 'http';
196
+ console.log(`zero-http full-server listening on ${proto}://localhost:${port}`);
188
197
  if (process.argv.includes('--test')) runTests(port).catch(console.error);
189
198
  });
190
199
 
200
+
191
201
  /** Quick smoke tests using built-in fetch */
192
202
  async function runTests(port)
193
203
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zero-http",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Zero-dependency, minimal Express-like HTTP server and tiny fetch replacement",
5
5
  "main": "index.js",
6
6
  "files": [