HTMLKit or Plot #197
Unanswered
nonfungibletunji
asked this question in
Q&A
Replies: 1 comment
-
I'm not sure I see any reason to add HTMLKit or Plot examples. All three solutions do pretty much the same thing. They generate a block of text which can then be returned with correct headers by returning the following type struct HTML: HBResponseGenerator {
let html: String
public func response(from request: HBRequest) throws -> HBResponse {
let buffer = request.allocator.buffer(string: self.html)
return .init(status: .ok, headers: ["content-type": "text/html"], body: .byteBuffer(buffer))
}
}
func routeReturningHTML(request: HBRequest) -> HTML {
let html = generateHTMLUsingSomeLibrary()
return HTML(html: html)
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
instead of mustache is there an example using HTML
Beta Was this translation helpful? Give feedback.
All reactions