Odi-ts/odi

How to send HTML?

jepotter1-archive opened this issue · 2 comments

I have the following code in a controller:

@RouteGet("/hey") sayHello() {
    return `<h1>Hey!</h1>`
}

But the return type is text/plain. How do I make the return type text/html?

Oops, found that setType(...) method missed on the controller and existed only in local draft. Give me the few minutes, I will push updates. :)

Fixed in c888c90, just update odi to 0.2.13 version. And call the method in handler.

Example:

@RouteGet("/hey")
sayHello() {
    this.setType('text/html');

    return `<h1>Hey!</h1>`
}

In next major release (0.3.0) templates rendering functional will be added.