0
私は初心者モードまたはノードjです。愚かな質問を申し訳ありません。現在私はコマンドng new appname
でアプリケーションを作成しています。私はherokuでアップロードしたいと思います。そのために私は助けを得てserver.jsファイルを書きました。ここにあります。herokuでアップロード中にノードjs内の他のものに "ビューエンジンをejs"に変更するには
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);
});
このビューを検索し、そのフォルダからindex.ejsファイルを実行します。しかし、私は/ src/index.htmlファイルを実行したい。 誰でも助けてくれてどうすればそれを実行できますか?私は一日中それを無駄にした。私はこの親切に感謝します。
私はSRC /インデックスの代わりに、ビュー/インデックスを呼びたいです。私は何をすべきか? – maadi