Running our Example
You can run this example locally, or by deploying it to a hosting provider with node.js support like Heroku. Running it locally is easier, but you must have node.js and npm installed. Running it on Heroku requires you to have the heroku toolbelt installed and signing up for an account.
To run our code locally:
- Download the code from the button near the beginning of the article.
- Make sure you have node.js installed. If needed, install it.
- Unzip the archive you downloaded to a folder.
- Open a terminal and cd to the folder.
- Run npm install to install the required libraries
- Run node app.js to start the presentation
- Open http://localhost:8080 on your computer and enter your pass key (by default it is “kittens“).
- Open http://<your computer’s local ip address> on your phone and enter the same pass key.
Have fun!
To run the code on Heroku:
- Download the code from the button near the beginning of the article.
- Unzip it to a folder.
- Open a terminal and cd to the folder.
- Create a git repository, and commit.
- Create a new Heroku App
- Run git push heroku master.
Visit the URL of the app on every device you want to connect. The default pass key is “kittens”. Read more about deploying node.js apps to heroku here. If you use a different cloud hosting provider, the last three steps will be different.