File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 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` ) ;
You can’t perform that action at this time.
0 commit comments