Friday, 28 April 2017

Express js render : TypeError: this.engine is not a function

I am getting TypeError: this.engine is not a function. I don`t know why I am getting this error. Can anyone please help me to solve this issue.

var express = require('express');

var path = require('path');

var app = express();

//configure app
app.set('view engine', 'html');
app.set('views', path.join(__dirname, 'views'));

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


app.listen(3000, function() {
    console.log('Ready on port 1337');
});
<!DOCTYPE html>
<html>

<head>

</head>

<body>
    <div>Hello Express</div>
</body>

</html>

enter image description here



via Md Mehadi Hasan Mozumder

No comments:

Post a Comment