0
votes

[enter image description here][1]We developed node js app on local pc

the am trying to push the app (following the tutorial provide by IBM ) but after pushing successfully when i try to open the application (appname.mybluemix.com) i got "Internal Server Error"

Although the url take automatically the route of the login page of our application

The node js service is linked to availability monitoring service, mongo DB and IOT platform

Am sure am using the correct pushing commands because we already pushed another app from github and it works fine

Kindly check part of the CF log for our app

Thanks in advance

2019-01-19T08:31:06.48+0200 [APP/PROC/WEB/0] ERR at Layer.handle [as handle_request] (/home/vcap/app/node_modules/express/lib/router/layer.js:95:5)
2019-01-19T08:31:06.48+0200 [APP/PROC/WEB/0] ERR at trim_prefix (/home/vcap/app/node_modules/express/lib/router/index.js:317:13)
2019-01-19T08:31:06.48+0200 [APP/PROC/WEB/0] ERR at /home/vcap/app/node_modules/express/lib/router/index.js:284:7
2019-01-19T08:31:06.48+0200 [APP/PROC/WEB/0] ERR at Function.process_params (/home/vcap/app/node_modules/express/lib/router/index.js:335:12)
2019-01-19T08:31:06.48+0200 [APP/PROC/WEB/0] ERR at next (/home/vcap/app/node_modules/express/lib/router/index.js:275:10)
2019-01-19T08:46:06.44+0200 [APP/PROC/WEB/0] ERR Error: Failed to lookup view "login.ejs" in views directory "/home/vcap/app/views"
2019-01-19T08:46:06.44+0200 [APP/PROC/WEB/0] ERR at EventEmitter.render (/home/vcap/app/node_modules/express/lib/application.js:580:17)

1
Is it supposed to be looking for a login.ejs instead of login.js? Is that a typo?nitind

1 Answers

0
votes

I think this is most likely to be a problem with how you have constructed your express application, or copied it, and the default settings.

Express in looking for the embedded javascript template index.ejs that it thinks defines your index page. As it isn't found I guess you don't have it in /home/vcap/app/views

It will be looking for a ejs file either because you have explicitly said it should in your routes, or it is looking for a .ejs module because the default template engine has been set as ejs for the application.

Somewhere in your application, most likely app.js, you will have a line like

app.set('view engine', 'ejs');

Either modify this line to use the template engine that your index file does provide, or create an index.ejs file.