Redirecting you to Developer Center... Click here if you are not automatically redirected.
Start Visual Studio 2015 and create a new project (File | New Project…). In the
New Project dialog, navigate to
Select the template
Basic Node.js Web Server (Windows Universal)
When the project is created, there will be a server.js file with the code below. It creates simple server that will respond with ‘Hello World’ when a request is made. Documentation on how to use the http module can be found here.
--debugargument is required for debugging and is added automatically).
--use-loggeras 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
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>:1337. The result should look like the picture below.
You can set breakpoints, see variable values, etc. To stop the server, press on the ‘Stop Debugging’ button (or select Debug | Stop Debugging).
UWP namespaces are available for you to use in Node.js. The code below returns the date and time instead of ‘Hello World’ in the previous example.
The result from the code above should look like this:
You have the option to build and deploy your app without using the Visual Studio UI. To do this, follow the instructions below:
msbuild <Your solution name>.sln /p:configuration=release /p:platform=<arm | x86 | x64 >(use arm for Raspberry Pi 2 or 3 and x86 for MBM).
iotstartup listto get the full package name of your app.
iotstartup add headless <your package name>
shutdown /r /t 0to reboot your device. When the reboot completes, the app will be running.