简体   繁体   English

蒸气无法加载html和叶

[英]vapor can not load html and leaf

I use vapor load a html or leaf,it gives me error message '500'.The server log show me 我使用蒸气加载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]

Here is my code: 这是我的代码:

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

How can I solve this problem? 我怎么解决这个问题?

You should put your file into {Project Dir}/Resources/Views/ 您应该将文件放入{Project Dir}/Resources/Views/

In your case welcome.leaf should be in /Users/apple/Desktop/QSSwiftServer/Resources/Views/ 就您而言, welcome.leaf应该位于/Users/apple/Desktop/QSSwiftServer/Resources/Views/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM