I recently moved from Perfect to Vapor . In Perfect, you can do something similar without using an html file.
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()
}
)
In Vapor, the only way to return html is to do this. How can I return the html code without using the html file in pairs?
drop.get("/") { request in
return try drop.view.make("somehtmlfile.html")
}
source
share