Sunday, 19 March 2017

In Node-js, render(ejsfile) not working unless and until I change its directory name from view to views

profile.ejs file name saved in view folder, and on every request it gave status code: 500 error. Just on changing the folder name from view to views, its start working. No server internal error, no invalid command error, don't know why?

var express = require('express');
var app = express();
app.set('view engine', 'ejs');
app.get('/home',function(req, res){
 res.sendFile(__dirname + '/index.html');
});
app.get('/profile/:name', function(req, res){
  res.render('profile');
});
app.listen(3000);

just changing the directory same code start working, explain please! Thank you.



via ProgSMI

No comments:

Post a Comment