JavaScript Internal Server Error Node js internal server error 500,internal server error meaning,internal server

I am currently setting up a Heroku deployment. Everything works fine when it is run locally but I get the following error from Heroku.

at=info method=GET path="/" host=pure-cliffs-68507.herokuapp.com 
request_id=66cd6aa8-209d-4065-88ce-ad201ce6e713 fwd="210.86.90.97" 
dyno=web.1 connect=0ms service=24ms status=500 bytes=524 protocol=https
2017-07-03T15:05:22.180020+00:00 app[web.1]: GET / 500 19ms - 148b
2017-07-03T15:05:22.181519+00:00 app[web.1]: Error: Failed to lookup view " index.html" in views directory "/app"
2017-07-03T15:05:22.181520+00:00 app[web.1]:     at EventEmitter.render (/app/node_modules/express/lib/application.js:580:17)
2017-07-03T15:05:22.181521+00:00 app[web.1]:     at ServerResponse.render  (/app/node_modules/express/lib/response.js:971:7)
2017-07-03T15:05:22.181521+00:00 app[web.1]:     at /app/routes.js:8:7
2017-07-03T15:05:22.181522+00:00 app[web.1]:     at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2017-07-03T15:05:22.181522+00:00 app[web.1]:     at next (/app/node_modules/express/lib/router/route.js:137:13)
2017-07-03T15:05:22.181523+00:00 app[web.1]:     at Route.dispatch (/app/node_modules/express/lib/router/route.js:112:3)
2017-07-03T15:05:22.181523+00:00 app[web.1]:     at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2017-07-03T15:05:22.181524+00:00 app[web.1]:     at /app/node_modules/express/lib/router/index.js:281:22
2017-07-03T15:05:22.181525+00:00 app[web.1]:     at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
2017-07-03T15:05:22.181525+00:00 app[web.1]:     at next (/app/node_modules/express/lib/router/index.js:275:10)

I beleive it is something to do with the file paths. I currently have everything in the base directory (ie project/) and therefore am using the following.

app.use(express.static(path.join(__dirname, '/')));
app.set('views', __dirname);

Here are some of my get requests

app.get('/', function(req, res) {
    res.render('index.html'); 
});

app.get('/browsePage', function(req, res) {
    res.render('browsePage.html'); 

});

Thank you for your help in advance.

Answer:1

You can't render html pages in node.js. You can try sending html files:

app.get('/', function(req, res) {
   res.sendFile('index.html'); 
});

app.get('/browsePage', function(req, res) {
   res.sendFile('browsePage.html'); 
});
Answer:2

I am using the following angular binding on an input: <li data-ng-repeat="value in model.Values"> <input type="number" data-required data-min="-10" data-max="10" ...

I am using the following angular binding on an input: <li data-ng-repeat="value in model.Values"> <input type="number" data-required data-min="-10" data-max="10" ...

  1. conditional value input
  2. ng-class conditional input value
  3. html input value conditional
  4. angular input value conditional
  5. angular 2 conditional input value
  6. angularjs conditional input value

WhY this notation does not work const result1 = _model['dataarray[0]']; _model.dataarray exists and it is an array with 2 elements this "console.log(_model.dataarray[0])" works fines

WhY this notation does not work const result1 = _model['dataarray[0]']; _model.dataarray exists and it is an array with 2 elements this "console.log(_model.dataarray[0])" works fines

  1. data binding with livedata android
  2. data binding with fragments android
  3. data binding with textbox in c#
  4. data binding with recyclerview
  5. data binding with include layout
  6. data binding with viewmodel android
  7. data binding with mvvm android
  8. data binding with kotlin
  9. data binding with tabular data control
  10. data binding with recyclerview kotlin
  11. data binding with ngmodel
  12. data binding with web
  13. data binding with viewmodel
  14. data binding with androidx
  15. data binding with mvvm
  16. data binding with live data
  17. data binding with fragments
  18. data binding with windows forms
  19. data binding with jquery
  20. data binding with edittext android

I'd like to combine a set of $.each statements looping through an array of arrays containing objects of k:v pairs into a single $.each which I can increment. Structure of array returned from PHP: an ...

I'd like to combine a set of $.each statements looping through an array of arrays containing objects of k:v pairs into a single $.each which I can increment. Structure of array returned from PHP: an ...

  1. increment array foreach

Suceeded in randomizing a quote but now the values name and quote don't match, is there a way to make json.name and json.quote share the same random value? so Einstein's quote isn't matched with the ...

Suceeded in randomizing a quote but now the values name and quote don't match, is there a way to make json.name and json.quote share the same random value? so Einstein's quote isn't matched with the ...