gpt4 book ai didi

swift - vapor 无法加载 html 和 leaf

转载 作者:行者123 更新时间:2023-11-28 08:02:17 27 4
gpt4 key购买 nike

我使用 vapor 加载 html 或 leaf,它给我错误消息“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!"])
}

我该如何解决这个问题?

最佳答案

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

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

关于swift - vapor 无法加载 html 和 leaf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46312635/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com