const express = require('express');
const app = express();
var path = require('path');
app.get('/', function(req,res){
res.sendFile(path.join(__dirname+'/login.html'));
});
app.get('/views', function(req,res){
res.sendFile(path.join(__dirname+'/views/index.html'));
});
// Start the server
const PORT = process.env.PORT || 8080;
app.listen(PORT,() => {
console.log(`App listening on port ${PORT}`);
console.log('Press Ctrl+C to quit.');
});
// [END app]
login.htmlのレンダリングは問題なく動作します。私のビューのディレクトリにindex.htmlがあり、index.htmlのレンダリングに苦労しています。私はどこかでapp.useを使用しているはずですが、私はすでに試してみましたが、localhost:8080/viewsを入力すると正しく動作するようには分かりません。index.htmlは正常に動作しますビューフォルダ内node.jsで特定のディレクトリから特定のパスにhtmlページをレンダリングする方法