list more addresses

This commit is contained in:
David Reed 2022-12-03 16:05:00 -05:00
parent 423502d17c
commit b057a53107
No known key found for this signature in database
GPG key ID: 2211691D8A1EE72F

View file

@ -4,6 +4,7 @@ import { createServer } from "node:http";
import { publicPath } from "ultraviolet-static"; import { publicPath } from "ultraviolet-static";
import { uvPath } from "@titaniumnetwork-dev/ultraviolet"; import { uvPath } from "@titaniumnetwork-dev/ultraviolet";
import { join } from "node:path"; import { join } from "node:path";
import { hostname } from "node:os";
const bare = createBareServer("/bare/"); const bare = createBareServer("/bare/");
const app = express(); const app = express();
@ -45,8 +46,13 @@ if (isNaN(port)) port = 8080;
server.on("listening", () => { server.on("listening", () => {
const address = server.address(); const address = server.address();
// by default we are listening on 0.0.0.0 (every interface)
// we just need to list a few
console.log("Listening on:");
console.log(`\thttp://localhost:${address.port}`);
console.log(`\thttp://${hostname()}:${address.port}`);
console.log( console.log(
`Listening on http://${ `\thttp://${
address.family === "IPv6" ? `[${address.address}]` : address.address address.family === "IPv6" ? `[${address.address}]` : address.address
}:${address.port}` }:${address.port}`
); );