流星公用文件夹不起作用 [英] Meteor public folder not working

查看:62
本文介绍了流星公用文件夹不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 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

http://localhost:3000/myphoto.jpg

todos 示例提供来自公共目录的图像.退出您所在的任何项目并运行: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:

http://localhost:3000/destroy.png 

您将看到的图像位于 public/.

The image you will see lives in public/.

这篇关于流星公用文件夹不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆