Monday, 10 April 2017

How to change "view engine to ejs" to something else in Node js while uploading on heroku

I am beginner to angularjs or Node js. sorry for stupid question. currently i have make application with command ng new appname. and i want to upload it on heroku. for that i got help and write server.js file. here it is.

var express = require('express');
var app = express();
// set the port of our application
// process.env.PORT lets the port be set by Heroku
var port = process.env.PORT || 8080;

// set the view engine to ejs
app.set('src engine', 'ejs');
// make express look in the public directory for assets (css/js/img)
app.use(express.static(__dirname + '/about'));

// set the home page route
app.get('/', function(req, res) {

    // ejs render automatically looks in the views folder
    res.render('index');
});

app.listen(port, function() {
    console.log('Our app is running on http://localhost:' + port);
});

this search for views folder and run index.ejs file from that folder. but i want to run /src/index.html file. can anyone please help me how can i run it? i have wasted my whole day in it. please.. i will be thankful for this kindness.



via Amad ud Din

No comments:

Post a Comment