Skip to content

[Decorator] Templating decorator (Jade, EJS, etc...) #9

Description

@Romakita

@ResponseView(partialName) decorator use the render express method to send the response using the template HTML (or ejs, jade, etc...). In addition, the data returned by the method, will be used by ResponseView to provide the final HTML response (or any other format).

@Controller("/events")
export class EventCtrl {

    @Get("/:id")
    @ResponseView("eventCard")
    public get(request: Express.Request, response: Express.Response): any {
        return {startDate: new Date(), name: "MyEvent"};
    }
}

eventCard => views/eventCard.html

Annotation's name is a proposal. If you have a better idea of name, tell-it !

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions