0

I'm having problems whid a project in Heroku, the project works perfectly offline but one of the pages is not found in the ones is deployed

bin
--www
public
--images
--javascripts
--stylesheets
routes
--about.js
--contact.js
--index.js
--sendEmail.js
views
--include
----footer.ejs
----head.ejs
----nav.ejs
----popup1.ejs
----popup2.ejs
----popup3.ejs
----scripts.ejs
--contact.ejs
--about.ejs
--error.ejs
--index.ejs
.gitignore
app.js
package-lock.json
package.json

1.app.js
in this, all the routes are connected to the middleware and works as intended offline,

var createError = require('http-errors');
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');

var indexRouter = require('./routes/index');
var contactRouter = require('./routes/contact');
var aboutRouter = require('./routes/about');
var emailRouter = require('./routes/sendEmail');

var app = express();

// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');

app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

app.use('/', indexRouter);
app.use('/contact', contactRouter);
app.use('/about', aboutRouter);
app.use('/send', emailRouter);


});


});

module.exports = app;

enter image description here

the project works offline, but in Heroku, it shows me this error.

  • Please don't post code nor errors in images, post the error message text itself. Also, please search before asking questions. Please read [how to ask](https://stackoverflow.com/help/how-to-ask) before asking additional questions. This is a duplicate of this question: [Error: Failed to lookup view in Express](https://stackoverflow.com/questions/10216395/error-failed-to-lookup-view-in-express) – Andy Ray Sep 25 '22 at 00:22

1 Answers1

0

The problem was that the contact name was Contact.ejs and not contact.ejs. This case-insensitivity works on local machine but not on Heroku

Ashutosh Patole
  • 926
  • 1
  • 7
  • 23