I have a VPS in bluehost, I installed node and npm through SSH and I've managed to run a node app in www.mywebsite.com:3000, so I have two questions:
1) How do I run the app.js so when it 'listens' to www.mywebsite.com ? I mean when I go to www.mywebsite.com I see my index.ejs and everything like in my localhost instead of going to www.mywebsite.com:3000.
2) When I managed to run the node app in www.mywebsite.com:3000 it would close if I stopped the SSH conn, it doesn't stay 'forever', how do I start the server once and keep it up? Like with Heroku, where one would upload the package.json with the script "node app.js" and the server will always be up and running.
How I ran the node app in the port 3000:
First I ran npm init
, then I installed express npm install --save express
app.js:
var express = require("express");
var app = express();
app.get("/", function(req,res){
res.send("hi");
});
app.listen(3000, functions(){
console.log("Server Started");
});