zero-http 0.2.3 → 0.2.4
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.
- package/README.md +2 -2
- package/documentation/full-server.js +3 -13
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -49,10 +49,10 @@ app.listen(3000)
|
|
|
49
49
|
|
|
50
50
|
## Demo
|
|
51
51
|
|
|
52
|
-
You can view the live documentation and playground at https://
|
|
52
|
+
You can view the live documentation and playground at https://z-http.com, or run the demo locally:
|
|
53
53
|
|
|
54
54
|
```bash
|
|
55
|
-
|
|
55
|
+
npm run docs
|
|
56
56
|
# open http://localhost:3000
|
|
57
57
|
```
|
|
58
58
|
|
|
@@ -179,25 +179,15 @@ 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/zero-http.molex.cloud/fullchain.pem';
|
|
184
|
-
const keyPath = '/www/server/panel/vhost/cert/zero-http.molex.cloud/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;
|
|
190
182
|
|
|
191
183
|
// --- Server Startup ---
|
|
192
|
-
const port = process.env.PORT ||
|
|
193
|
-
const server = app.listen(port,
|
|
184
|
+
const port = process.env.PORT || 3000;
|
|
185
|
+
const server = app.listen(port, () =>
|
|
194
186
|
{
|
|
195
|
-
|
|
196
|
-
console.log(`zero-http full-server listening on ${proto}://localhost:${port}`);
|
|
187
|
+
console.log(`zero-http full-server listening on http://localhost:${port}`);
|
|
197
188
|
if (process.argv.includes('--test')) runTests(port).catch(console.error);
|
|
198
189
|
});
|
|
199
190
|
|
|
200
|
-
|
|
201
191
|
/** Quick smoke tests using built-in fetch */
|
|
202
192
|
async function runTests(port)
|
|
203
193
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zero-http",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Zero-dependency, minimal Express-like HTTP server and tiny fetch replacement",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"bugs": {
|
|
35
35
|
"url": "https://github.com/tonywied17/zero-http-npm/issues"
|
|
36
36
|
},
|
|
37
|
-
"homepage": "https://
|
|
37
|
+
"homepage": "https://z-http.com",
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": ">=14.0.0"
|
|
40
40
|
},
|