I have a web app that works well in local but when uploading it to heroku the following came out in the logs
2017-01-01T00:30:57.874896+00:00 app[web.1]: Error: Failed to lookup view "notFound" in views directory "/app/views"
2017-01-01T00:30:57.874919+00:00 app[web.1]: at EventEmitter.render (/app/node_modules/express/lib/application.js:579:17)
2017-01-01T00:30:57.874920+00:00 app[web.1]: at ServerResponse.render (/app/node_modules/express/lib/response.js:960:7)
2017-01-01T00:30:57.874921+00:00 app[web.1]: at exports.notFound (/app/routes/index.js:31:7)
2017-01-01T00:30:57.874922+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2017-01-01T00:30:57.874922+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/route.js:131:13)
2017-01-01T00:30:57.874923+00:00 app[web.1]: at Route.dispatch (/app/node_modules/express/lib/router/route.js:112:3)
2017-01-01T00:30:57.874923+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2017-01-01T00:30:57.874924+00:00 app[web.1]: at /app/node_modules/express/lib/router/index.js:277:22
2017-01-01T00:30:57.874924+00:00 app[web.1]: at param (/app/node_modules/express/lib/router/index.js:349:14)
2017-01-01T00:30:57.874925+00:00 app[web.1]: at param (/app/node_modules/express/lib/router/index.js:365:14)
I did a little research and I saw that I had to put this in node's main file
var path = require('path');
app.use(express.static(path.join(__dirname, 'public')));
app.set('views'(path.join(__dirname, 'views')));
But that still did not work for me so I went to the node documentation and found the solution that I share below in case someone has the same problem