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")
}
你有什么事也问题吗?请修改您的帖子并提供一个明确的问题。 –