@@ -2,6 +2,7 @@ import http from 'http';
22import fs from 'fs' ;
33import path from 'path' ;
44import { fileURLToPath } from 'url' ;
5+ import os from 'os' ;
56
67const __filename = fileURLToPath ( import . meta. url ) ;
78const __dirname = path . dirname ( __filename ) ;
@@ -144,7 +145,7 @@ const server = http.createServer((req, res) => {
144145 } ) ;
145146} ) ;
146147
147- server . listen ( PORT , ( ) => {
148+ server . listen ( PORT , '0.0.0.0' , ( ) => {
148149 console . log ( `\n======================================================` ) ;
149150 console . log ( `✅ [modelviewer.dev] Local Dev Server is Running!` ) ;
150151 console . log ( `======================================================\n` ) ;
@@ -153,5 +154,15 @@ server.listen(PORT, () => {
153154 console . log ( `- model-viewer: ${ versions . modelViewer } ` ) ;
154155 console . log ( `- postprocessing: ${ versions . postprocessing } \n` ) ;
155156 console . log ( `The server is currently listening for connections.` ) ;
156- console . log ( `👉 PLEASE OPEN YOUR BROWSER TO: http://localhost:${ PORT } / \n` ) ;
157+ console . log ( `👉 Local: http://localhost:${ PORT } /` ) ;
158+
159+ const interfaces = os . networkInterfaces ( ) ;
160+ for ( const name of Object . keys ( interfaces ) ) {
161+ for ( const iface of interfaces [ name ] ) {
162+ if ( iface . family === 'IPv4' && ! iface . internal ) {
163+ console . log ( `👉 Network: http://${ iface . address } :${ PORT } /` ) ;
164+ }
165+ }
166+ }
167+ console . log ( `\n` ) ;
157168} ) ;
0 commit comments