[英]Why isn't fs loading my index.html file in my node.js application?
[英]Are there any obvious reasons my node.js react app is not recognizing any index.html file?
您可以在此處查看該應用程序: https : //02e7822e.ngrok.io
我的主要問題是index.html始終無法連接,這意味着
1)網站根本無法擴展到移動設備
2)沒有圖標
有什么明顯的我想念的嗎? 我之前已經建立過網站,但是index.js每次看起來總是有些不同,因此這里僅供參考:
import AppBar from '../components/AppBar';
import Block from '../components/Block';
import React from "react";
class Index extends React.Component {
render() {
return (
<div>
<AppBar/>
<Block/>
</div>
)
}
}
export default Index;
在以前的網站中,我已經能夠使用ReactDOM和document.getElementByID來(對我來說)對index.html進行某種形式的引用,但是我嘗試了這一點,但僅出現語法錯誤。
因此,看起來您使用了create-react-app
並更改了整個文件夾的結構。...不要那樣做。
這是官方文件夾結構的鏈接:
https://facebook.github.io/create-react-app/docs/folder-structure
也。 當與React一起使用服務器時,我看到了一個文件夾結構,其中服務器保存在應用程序的根目錄中,然后React
保存在單獨的client
文件夾中。
my-main-app-folder
my-main-app-folder/
client/ (This is the folder where React lives)
public/
index.html
favicon.ico
node_modules/
src/
App.js
index.js
package.json
README.md
.gitignore
server.js
package.json
package-lock.json
README.md
與此類似
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.