Runnnig node.js as a windows service

How to configure WinSer to run a specific javascript file? I understood that I have to add in package.json the lines:

    {
     "name": "MY_SERVICE",
     "scripts": {
      "install-windows-service": "node_modules\\.bin\\winser -i",
      "uninstall-windows-service": "node_modules\\.bin\\winser -r"
    }

I couldn't understand where to configure what javascript file I should run?

From a command line in the same folder as your package.json, run

winser -i

to install your node app (as defined in server.js in the same folder) as a service. Note that if you have not logged off and back on since you installed winser, your path to winser.cmd will not be initialized (it needs something like C:\Users\YourName\AppData\Roaming\npm\ in the path.