流星公用文件夹不起作用

编程入门 行业动态 更新时间:2024-10-28 22:23:46
本文介绍了流星公用文件夹不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

localhost:3000/destroy.png

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

The image you will see lives in public/.

更多推荐

流星公用文件夹不起作用

本文发布于:2023-07-26 14:24:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1216689.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件夹   不起作用   流星

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!