Skip to content

Commit a46406f

Browse files
authored
Update VRtraining.js
Improvements
1 parent 8521b68 commit a46406f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

js/VRtraining.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@ import { open } from 'open';
88
class TrainingHandler extends SimpleHTTPRequestHandler {
99
// Override the do_GET method to handle custom requests.
1010
do_GET(req, res) {
11-
// Custom handling can go here, or just use the parent class behavior.
12-
return super.do_GET(req, res);
11+
// Check if the requested file is 'demo.html'.
12+
if (req.url === '/demo.html') {
13+
// Serve the 'demo.html' file.
14+
this.sendFile(req, res, 'demo.html');
15+
} else {
16+
// Use the parent class behavior for other requests.
17+
super.do_GET(req, res);
18+
}
1319
}
1420
}
1521

@@ -23,5 +29,5 @@ server.listen(port);
2329
// Print a message to the console indicating that the server is running.
2430
console.log(`Serving VR training at http://localhost:${port}`);
2531

26-
// Open a new tab in the default browser to access the training page.
32+
// Open a new tab in the default browser to access the 'demo.html' page.
2733
open(`http://localhost:${port}/demo.html`);

0 commit comments

Comments
 (0)