$ cd /lib/systemd/system
$ sudo vi /lib/systemd/system/myNode.service
and put the following contents in it (example):
[Unit]
Description=Start app.js on my Node
After=network.target
[Service]
Environment=NODE_PORT=3001
Type=simple
User=pi
ExecStart=/usr/bin/node /home/pi/myApp/app.js
Restart=on-failure
[Install]
WantedBy=multi-user.target
You have to do this whenever any of the service files change at all so that systemd picks up the new info.
$ sudo systemctl daemon-reload
If you want to make the application start up when the machine boots, you accomplish that by enabling it
$ sudo systemtl enable myNode.service
Other options
$ sudo systemctl [status,start,stop,restart,enable,disable] myNode.service
List
$ systemctl list-unit-files | grep enabled