I recently made the switch from Perfect to Vapor.In Perfect you could do something like this without using a 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 I found to return the html is to do this.How could I return html code without using a html file in vapor?
drop.get("/") { request in
return try drop.view.make("somehtmlfile.html")
}