Skip to content

Commit 8521b68

Browse files
authored
Create VRtraining.js
1 parent 247d0ed commit 8521b68

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

js/VRtraining.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Import the necessary modules.
2+
import http from 'http';
3+
import { SimpleHTTPRequestHandler } from 'http';
4+
import { TCPServer } from 'net';
5+
import { open } from 'open';
6+
7+
// Define the TrainingHandler class.
8+
class TrainingHandler extends SimpleHTTPRequestHandler {
9+
// Override the do_GET method to handle custom requests.
10+
do_GET(req, res) {
11+
// Custom handling can go here, or just use the parent class behavior.
12+
return super.do_GET(req, res);
13+
}
14+
}
15+
16+
// Define the port to use for the server.
17+
const port = 8001;
18+
19+
// Create the server and start listening on the specified port.
20+
const server = http.createServer(TrainingHandler);
21+
server.listen(port);
22+
23+
// Print a message to the console indicating that the server is running.
24+
console.log(`Serving VR training at http://localhost:${port}`);
25+
26+
// Open a new tab in the default browser to access the training page.
27+
open(`http://localhost:${port}/demo.html`);

0 commit comments

Comments
 (0)