[英]How to create a public accessible folder in react?
I am using React Boilerplate . 我正在使用React Boilerplate 。 I am running that project on my localhost.
我在本地主机上运行该项目。 So I have a folder "ankur" outside "app" directory.
所以我在“ app”目录外有一个文件夹“ ankur”。 check out folder structure .
检出文件夹结构 。 How can I access that folder via link?
如何通过链接访问该文件夹? (ex: localhost:3000/ankur)?
(例如:localhost:3000 / ankur)?
If required I can move the folder. 如果需要,我可以移动文件夹。
I have no knowledge in webpack. 我对webpack不了解。
I recommend using the react boilerplate provided by Facebook create-react-app . 我建议使用Facebook create-react-app提供的react样板。 Once you're done with the setup, your directory should look like this:
完成设置后,您的目录应如下所示:
my-app
├── README.md
├── node_modules
├── package.json
├── .gitignore
├── public
│ ├── favicon.ico
│ ├── index.html
│ └── manifest.json
└── src
├── App.css
├── App.js
├── App.test.js
├── index.css
├── index.js
├── logo.svg
└── registerServiceWorker.js
Then, just put your folder/files that you want to be accessible in the public
folder. 然后,只要把你想在访问您的文件夹/文件
public
文件夹。 In your case, just put ankur
folder inside public folder and access it through localhost:3000/ankur
在您的情况下,只需将
ankur
文件夹放在公用文件夹中,然后通过localhost:3000/ankur
访问它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.