My question is about running HTTP-server in combination with PM2.
The problem i face is that:
- HTTP-server requires as input a folder which is the root of the website and a port number to run the website on.
- PM2 doesn't recognize the HTTP-server command, even when HTTP-server is installed with the -g option.
So i tried the following (note the double dash which should pass the parameters to the HTTP-server script:
/node_modules/http-server/lib$ pm2 start http-server.js -- /home/unixuser/websiteroot -p8686
But it doesn't work.
I also tried:
http-server /home/unixuser/websiteroot -p8686
Which does work, but doesn't have the great support of pm2 ?
Any suggestions would be great, thanks!
or
PM2 modules it self has in-build static file to be served, which is similar to http-server https://pm2.keymetrics.io/docs/usage/expose/
You almost had it.
Check where http-server is located by executing:
You should get something like this
/usr/bin/http-server
Then
cd
to the directory you want to serve files from and execute:--name my-file-server
is optional, but--
is required to pass arguments through to thehttp-server
command.if we have a build generated by grunt,then go to its path and hit:
Now check app status at
localhost:8080