fix: listen on all interfaces for LAN testing
This commit is contained in:
@@ -9,6 +9,6 @@ npm ci
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Then open <http://127.0.0.1:4173/> in Chromium.
|
||||
The server listens on `0.0.0.0:4173` by default. Open `http://127.0.0.1:4173/` locally, or `http://<主机局域网IP>:4173/` from another device.
|
||||
|
||||
The public checkout intentionally excludes private research inputs and local acceptance artifacts; those are kept in the developer workspace and are covered by `.gitignore`.
|
||||
|
||||
+4
-3
@@ -1,9 +1,10 @@
|
||||
import { createReadStream } from "node:fs";
|
||||
import { stat } from "node:fs/promises";
|
||||
import { createServer } from "node:http";
|
||||
import { extname, join, normalize, relative, resolve } from "node:path";
|
||||
import { extname, join, relative, resolve } from "node:path";
|
||||
|
||||
const root = resolve("dist");
|
||||
const host = process.env.HOST ?? "0.0.0.0";
|
||||
const port = Number(process.env.PORT ?? 4173);
|
||||
const contentTypes = {
|
||||
".html": "text/html; charset=utf-8",
|
||||
@@ -31,6 +32,6 @@ const server = createServer(async (request, response) => {
|
||||
}
|
||||
});
|
||||
|
||||
server.listen(port, "127.0.0.1", () => {
|
||||
console.log(`JPW7 M0 server listening on http://127.0.0.1:${port}`);
|
||||
server.listen(port, host, () => {
|
||||
console.log(`JPW7 M0 server listening on http://${host}:${port}`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user