我是 Meteor 的新手,我正在尝试了解如何提供静态内容 - 图像、JS 等.我按照文档创建了正确的文件夹结构(它并没有真正涉及) 但向此内容发出请求只会故障转移到主应用程序页面.
I'm new to Meteor and I'm trying to understand how to serve static content - images, JS, etc.. I've followed the docs by creating the correct folder structure (which it doesn't really touch on) but making requests to this content just fails over to serving the main app page instead.
例如 - 将图像放入app_root"/public/image.png 并向 localhost:3000/image.png 发出请求只会返回主应用程序页面.
For instance - putting an image in "app_root"/public/image.png and making a request to localhost:3000/image.png just returns the main app page.
知道我在这里做错了什么吗?谢谢!
Any clue what I'm doing wrong here? Thanks!
推荐答案你描述的设置在我看来是正确的.public/ 中的媒体像
The setup you have described sounds correct to me. Media in public/ are served like
localhost:3000/myphoto.jpgtodos 示例提供来自公共目录的图像.退出您所在的任何项目并运行:meteor create --example todos 然后 cd 进入 todos/并运行 meteor.然后打开:
The todos example serves images from the public directory. Just back out of whatever project you're in and run: meteor create --example todos then cd into todos/ and run meteor. Then open:
localhost:3000/destroy.png您将看到的图像位于 public/.
The image you will see lives in public/.
更多推荐
流星公用文件夹不起作用
发布评论