Skip to content

[Decorator] Response formatting #10

@Romakita

Description

@Romakita

@ResponseSet(headers) let you to configure response header from annotation.

@Controller("/calendars")
export class CalendarCtrl {

    @Get("/:id")
    @ResponseSet({"Content-Type": "application/json", status: 200})
    public get(): ICalendar {

        return <ICalendar> {id: request.params.id, name: "test"};
    }
// or
    @Get("/:id")
    @ResponseSet("Content-Type",  "application/json")
    @ResponseSet("status",  200)
    public get(): ICalendar {

        return <ICalendar> {id: request.params.id, name: "test"};
    }
}

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