Bind WebGL server to all interfaces
This commit is contained in:
+3
-2
@@ -3,6 +3,7 @@ const fs = require('fs');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const PORT = process.env.PORT || 24710;
|
const PORT = process.env.PORT || 24710;
|
||||||
|
const HOST = process.env.HOST || '0.0.0.0';
|
||||||
const ROOT = __dirname;
|
const ROOT = __dirname;
|
||||||
|
|
||||||
const MIME = {
|
const MIME = {
|
||||||
@@ -150,12 +151,12 @@ function serveStatic(req, res) {
|
|||||||
http.createServer((req, res) => {
|
http.createServer((req, res) => {
|
||||||
if (req.url === '/' || req.url === '/index.html') return serveIndex(res);
|
if (req.url === '/' || req.url === '/index.html') return serveIndex(res);
|
||||||
serveStatic(req, res);
|
serveStatic(req, res);
|
||||||
}).listen(PORT, () => {
|
}).listen(PORT, HOST, () => {
|
||||||
console.log('');
|
console.log('');
|
||||||
console.log(' ╔══════════════════════════════════════════════════╗');
|
console.log(' ╔══════════════════════════════════════════════════╗');
|
||||||
console.log(' ║ 运动伤害现场急救虚拟仿真实验 - WebGL Server ║');
|
console.log(' ║ 运动伤害现场急救虚拟仿真实验 - WebGL Server ║');
|
||||||
console.log(' ║ ║');
|
console.log(' ║ ║');
|
||||||
console.log(' ║ Server running at: http://localhost:' + PORT + ' ║');
|
console.log(' ║ Server running at: http://' + HOST + ':' + PORT + ' ║');
|
||||||
console.log(' ║ Press Ctrl+C to stop ║');
|
console.log(' ║ Press Ctrl+C to stop ║');
|
||||||
console.log(' ╚══════════════════════════════════════════════════╝');
|
console.log(' ╚══════════════════════════════════════════════════╝');
|
||||||
console.log('');
|
console.log('');
|
||||||
|
|||||||
Reference in New Issue
Block a user