1. Start by launching a text editor of your choice. 2. Next, type the following into the text editor you’ve just opened: var http = require('http'); http.createServer(function (req, res) res.writeHead(200, {'Content-Type': 'text/html'}); res.end('Hello World!'); }). listen (8080); 3. Save the file, then exit. Open the PowerShell, and enter the following: node \users\<your_username>\myprogram.js It will look like nothing has happened. In reality, your script is running in the background. You may see a Windows Defender notice about allowing traffic – for now, click Allow. 4. Next, open a web browser, and enter the following into the address bar: http://localhost:8080 In the very upper-left corner, you should see the text Hello World! Right now, your computer is acting like a server. Any other computer that tries to access your system on port 8080 will see the Hello World notice. To turn off the program, switch back to PowerShell and press Ctrl+C. The system will switch back to a command prompt. You can close this window whenever you are ready.
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter