Express Node.js app

Set up your PC

  • Install Windows 10 with November update.
  • Install Visual Studio 2017.
  • Install the latest Node.js Tools for Windows IoT from here.

Create a new Express (Windows Universal) project

Start Visual Studio 2017 and create a new project (File | New Project…). In the New Project dialog, navigate to Node.js as shown below (in the left pane in the dialog: Templates | JavaScript | Node.js).

Select the template Basic Node.js Express 4 Application (Windows Universal)

Node.js Windows Universal New Express Project Dialog

When the new project is created, you will see the dialog shown below asking if you want to use npm to install Express and its dependencies to the location of the project. Click Yes.

npm Prompt

After clicking yes, npm will run in the background and install the dependencies. Once that is complete, your project should look like the picture shown below.

npm Express List

Deploy the server to your Windows IoT Core device

  • Go to the Project menu and select ‘ Properties.' You could also right-click on the project node in solution explorer to access Properties.
  • Enter the IP Address in the Remote Machine text box as shown below (the --debug argument is required for debugging and is added automatically).
  • You can also add --use-logger as an argument to redirect console output to a file in the local storage folder of the UWP application (C:\Data\Users\DefaultAccount\AppData\Local\Packages\<Your Project Name>_<Publisher Hash String>\LocalState\nodeuwp.log).
  • If you’re building for Minnowboard Max, select x86 in the dropdown. If you’re building for Raspberry Pi 2 or 3, select ARM.

    Node.js Windows Universal Project Properties

  • Now we’re ready to deploy to the remote Windows IoT Core device. Simply press F5 (or select Debug | Start Debugging) to start debugging the server.

  • When the server is running, open up a browser and enter the address http://<IP address of your device>:3000. The result should look like the picture below.

    Hello World Result

GitHub

No sample code available

Language: Node.js

Tags: intermediate, server, node.js, express

Verified to work with:
Windows 10 IoT Core: Version 10.0.15063.0
Visual Studio 2017
Windows SDK: Version 15063
(Included with Visual Studio)


Edit this page on GitHub


Was this page helpful?
Additional feedback?
Thank you! We appreciate your feedback.
Follow us