The Node Package Manager

Node Package Manager (npm) is a command-line tool used to install the packages for Node.js. We will use this tool to download and install our simple HTTP server. Follow the given steps to install the HTTP server:

  1. From your device, open Command Prompt or shell and enter this:
npm install http-server -g
  1. This will download and install http-server as a global tool. Now, let's test it.
  1. Use your Command Prompt or shell and change your folder to Android, like this:
//WINDOWS
cd c:Android
  1. Run http-server from the Android folder by entering the following:
http-server -p 9999
  1. You will see a list of endpoint URLs. Choose an endpoint that is on the same subnet as your Wi-Fi, the same subnet as your device. Copy or write down the text of the endpoint, as shown in the following excerpt:
Picking an endpoint URL
  1. Open a web browser on your device and enter the endpoint you selected in the preceding step. After you start making connections, you will see the log output shown in the preceding screen excerpt.
If you are unable to connect with your device, ensure that you are entering the full endpoint including the protocol, http://192.168.1.118:9999 in the example, but your endpoint will likely be different. Ensure that you allow any exceptions in your firewall for port 9999. Alternatively, you can turn off your firewall for testing. Just don't leave it off.
  1. You should see the Android folder listing in your browser, as we have configured our server to just list the contents of the Android folder. The following is an example of how this will look in your browser:
Browser showing the Android folder listing

Good! Now we have a way to simply server up any static web pages we need. In the next section, we will pull down the web ARCore examples and review them.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.103.59