[英]vapor can not load html and leaf
我使用蒸氣加載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/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.