A
A
Alexander Litvinov2014-08-07 13:19:30
JavaScript
Alexander Litvinov, 2014-08-07 13:19:30

How to set up PM2?

I started to deal with Node.js and got stuck with pm2 I run
the application on express.js like this pm2 start processes.json
The processes.json file itself

{
    "apps": [
        {
            "name": "Application",
            "script": "server.js",
            "port": "3000",
            "host": "127.0.0.1",
            "cwd": "./",
            "exec_interpreter" : "node",
            "watch": "true"
        }
    ]
}

5ba00f8ca2db4e6683959581c2d1957f.png
I'm trying to open 127.0.0.1:3000
In Server.js, port 3000 is listening. What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Litvinov, 2014-08-08
@Sander_Li

The problem was in the last lines of the server. Thanks for the help.

// If someone ran: "node server.js" then automatically start the server
if (path.basename(process.argv[1], '.js') == path.basename(__filename, '.js')) {
    module.exports.start()
}

S
Sergey Krasnodemsky, 2014-08-07
@Prognosticator

and what is the problem? explain
and there is nothing in the config, for the sake of which it was worth starting it
from the root of the site

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question