Hi,
I'm currently struggling with auto-starting a node server on boot.
I aim for the device to host a node server and auto-start it by running node server.js command on every boot.
Currently, i have a service file here: /etc/systemd/system/node.service
=== node.service ===
[Unit]
Description=My Node.js App
[Service]
ExecStart=/usr/bin/node /path/to/your/app.js
Restart=always
User=mha
Group=root
Environment=PATH=/usr/bin:/usr/local/bin
Environment=NODE_ENV=production
[Install]
WantedBy=multi-user.target
I have reloaded daemons and enabled the service with
`sudo systemctl enable node.service`
And the log shows that
`Serving at port 3000`
But whenever i try to access 10.0.0.1:3000, it shows:
`Cannot get /`
Any help would be appreciated.
Thank you so much!
Auto Start Node server on Boot
Re: Auto Start Node server on Boot
Is this on the PHL?
I don't know much about node servers, but the Node Red service is set up on the PHL in
/etc/systemd/system/multi-user.target.wants/mahalia-nodered.service
Maybe there are some clues from that configuration?
I don't know much about node servers, but the Node Red service is set up on the PHL in
/etc/systemd/system/multi-user.target.wants/mahalia-nodered.service
Maybe there are some clues from that configuration?
-
- Posts: 119
- Joined: Mon Jun 24, 2019 12:51 pm
Re: Auto Start Node server on Boot
If I understand you correctly, then your log on the PHL shows (1) that your nodejs app has actually started, and (2) that your nodejs app reacts to your connection by logging "Cannot get /". If this is not the reaction that you want, then you need to fix this inside your custom nodejs app, which is a topic not related to openMHA or PHL.