Also, if you modify the script to tell it where node.exe is located on the hard drive, you'll be able to copy the CMD script to any folder and double-click it to create a server for that folder. You can also test your website on a smartphone by opening the phone's browser and going to your PC's local IP address, with the port set to 8090, like so: 192.168.2.12:8090 Your computer's IP address will be slightly different, so look it up.
How to set this up Out of the box, you can just extract the ZIP file and run "run_server.cmd" to serve the current folder as a website if you want.
But you don't have to copy ALL of this every time you want to test another website. You can just extract this ZIP file one time to any folder and just copy "run_server.cmd" to any folder that you want to test as a website. You want to place it where you want your website's "root" to be, then edit the copied run_server.cmd to point to the folder where you originally extracted all the other files. There are detailed instructions included inside of run_server.cmd as REM comments
June 19, 2022 Subject:
I just updated the script
. Added Windows XP support
While testing a very old website, I've discovered that this script will work in Windows XP SP3 by using Node JS version 5.12 so I added a version of the script that will run under that Operating System. NodeJS test-server for WinXP . zip
One thing to note: if Google Chrome is not installed, the script will complain about "Application not found" but that's not a problem. To view your test website, type this URL into any web browser on the same computer that is running the script:
You can also view your test website on other devices on your local network if you know the local IP address of the computer that is running Node JS. For example I often do this to test websites on my phone.