Hassan Sardar
Hassan Sardar

Reputation: 4523

Start Node Js Server Automatically on Pc Start Up

I have a Node Server.

And I want that my Node Server starts automatically when my Pc Starts.

Right Now I am doing this Manually.

Like this:

1) First I open Command Prompt.

2) Than I Type

cd node

3) Thank I type

node server.js

I want these 3 Step to perform automatically when my Pc starts.

Any solution please ?

Upvotes: 0

Views: 2191

Answers (2)

sQVe
sQVe

Reputation: 2015

The simple way would be to write a .bat script that you launch on startup.


Another option, that I personally would have used, is node-windows (or other modules like it) to create a Windows Service, running it in the background. You can specify if you want your Service to start automatically in the background or not when Windows starts.

Upvotes: 1

Daniel Park
Daniel Park

Reputation: 4021

Write a simple .bat script and add the script as described here. Assuming you mean Windows (cmd), this should work for you. Also it might be a good idea to specify an absolute path for the node executable, and/or file.

Upvotes: 0

Related Questions