Reputation: 21
i have two files app.js and landing.ejs and while running server ,it displays no error and the server is running but when i go to http://localhost:3000/ iam getting the name of the ejs file ,not the html content in the ejs file..please help me with this.
Upvotes: 0
Views: 1087
Reputation: 107
Use this code in your app.js file. Set ejs view engine in app.js
var express = require('express');
var app = express();
// set the view engine to ejs
app.set('view engine', 'ejs');
app.set("views", "views/")
Then use get request for your landing page in your app.js file
app.get('/', function(req, res) {
res.render('views/landing');
});
Upvotes: 1