蒸气不能加载html和叶子

时间:2017-09-20 03:10:25

标签: swift vapor

我使用蒸汽加载一个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!"])
    }

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

您应该将文件放入{Project Dir}/Resources/Views/

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