@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 !
@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).Annotation's name is a proposal. If you have a better idea of name, tell-it !