4
我最近從Perfect轉換到Vapor。在Perfect中,你可以做這樣的事情而不使用html文件。Swift - 使用HTML的蒸氣
routes.add(method: .get, uri: "/", handler: {
request, response in
response.setHeader(.contentType, value: "text/html")
response.appendBody(string: "<html><img src=http://www.w3schools.com/html/pic_mountain.jpg></html>")
response.completed()
}
)
蒸氣,我發現返回的HTML的唯一辦法就是做我this.How可以在不使用蒸汽HTML文件返回的HTML代碼?
drop.get("/") { request in
return try drop.view.make("somehtmlfile.html")
}
你有什麼事也問題嗎?請修改您的帖子並提供一個明確的問題。 –