【问题标题】:vapor can not load html and leaf蒸汽无法加载html和叶子
【发布时间】:2017-09-20 03:10:24
【问题描述】:

我使用蒸汽加载 html 或叶子,它给我错误消息“500”。服务器日志显示给我

[Data File Error: unable to load file at path /Users/apple/Desktop/QSSwiftServer/Resources/Views/welcome.leaf]  
 [Identifier: Core.DataFileError.load]  

[Possible Causes: file doesn't exist, missing read permissions at specified path, data read is corrupted, system issue]  

[Suggested Fixes: ensure that file permissions are correct for specified paths]  

[Documentation Links: https://developer.apple.com/reference/foundation/filemanager]

这是我的代码:

get { req in
        return try self.view.make("welcome.leaf", ["message": "Hello world!"])
    }

我该如何解决这个问题?

【问题讨论】:

  • @CalebKleveter 我遇到了同样的错误。你能解释得更详细些吗?
  • @lee 我没有足够的信息来回答这个问题。我需要知道文件的实际路径是什么、它的权限以及其他类似的东西。

标签: swift vapor


【解决方案1】:

你应该把你的文件放到{Project Dir}/Resources/Views/

在你的情况下,welcome.leaf 应该是/Users/apple/Desktop/QSSwiftServer/Resources/Views/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-07-28
    • 1970-01-01
    • 2023-03-03
    • 1970-01-01
    • 2020-04-29
    • 2020-10-17
    • 2018-06-25
    • 2020-05-15
    相关资源
    最近更新 更多