0
私はHerokuを使用してWebサイトを展開しています.node.jsを使用しています私のindex.jsファイルでは、チュートリアルではresponse.endで "Hello World"を使用しています。しかし、代わりに私のindex.htmlファイルを表示したい。どうすればいい?Herokuをindex.htmlにルーティングしようとしています
var http = require('http')
http.createServer(function (request, response){
response.writeHead(200, {"Content-Type": "text/plain"})
response.end("Hello World/n")
}).listen(process.env.PORT)
response.end( "hello world")をresponse.sendFile( 'index.html')に変更します。 – chenkehxx