0
Как я могу сделать следующий код server.js для .html файлов вместо .ejs в Node JS. Благодаря!Измените .ejs на .html
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('view engine', 'ejs');
// make express look in the public directory for assets (css/js/img)
app.use(express.static(__dirname + '/public'));
// 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);
});
@lessio Он говорит, что не может GET/on heroku – Lanie909
Я бы предположил, что это некоторая проблема конфигурации с героку. Код, кажется, работает отлично для меня! Добавление дополнительной информации к моему ответу – leesio