Error with Node.js app on A2Hosting but not on Heroku nor Localhost

1,149 views
Skip to first unread message

Wayne Bruton

unread,
Apr 15, 2018, 12:21:08 PM4/15/18
to nodejs

Hi, I am new to this group so I hope posting this question is okay? If not, please let me know the correct protocol.


I have a node app that works perfectly on Heroku but not on A2Hosting nor on FastComet:

It is an express app using ejs.

The Routes are simply as follows:

//Root Route
app
.get("/", function(req, res){
  res
.render("index");
});

app
.get("/contact", function(req, res){
   
// res.send("You have reached the contact page");
    res
.render("contact");
});

app
.get("/about", function(req, res){
   
// res.send("You have reached the contact page");
    res
.render("about");
});


I keep getting an error 503 on the contact and about routes but the initial index.ejs works just fine:

My .htaccess file is simply the following:

RewriteEngine On
RewriteRule ^$ http://127.0.0.1:49555/ [P,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://127.0.0.1:49555/$1 [P,L]
DirectoryIndex views/index.ejs


The App works perfectly on my localhost as well as on Heroku. I have tried everything and cannot seem to come right with my links to contact.ejs and about.ejs.

The tags are simply:

<nav>
   
<li><a href="/about">Samples</a> </li>
   
<li><a href="/contact">Contact</a> </li>
</nav>


The Index.ejs, contact.ejs and about.ejs are in a views folder.


This is the actual site on A2Hosting: http://www.digital-alchemy.solutions

And This is the site on Heroku which works perfectly: https://desolate-lowlands-92367.herokuapp.com


It really is a small app.


Any Help would be seriously appreciated.

Kind regards

Wayne

Albert

unread,
Jul 25, 2019, 1:05:17 PM7/25/19
to nodejs
Hi Wayne,

Did you ever get this to work.  I'm having similar difficulties

Regards,
Albert
Reply all
Reply to author
Forward
0 new messages