@ResponseStatus

Main

As we have described before, you can specify the response status for a specific endpoint by using the optionsargument in its the route decorator. Although, it is also possible to specify a response status at a controller level, this means, it will be applied to all your endpoints inside your controller. This is achieved by using the @ResponseStatus decorator.

Usage

Syntax:

@ResponseStatus(httpCode: Mandarine.MandarineMVC.HttpStatusCode)

The @ResponseStatus decorator must always be located at a class level, otherwise it will have no effect.

Example:

import { Controller, ResponseStatus } from "https://deno.land/x/mandarinets/mod.ts";

@Controller()
@ResponseStatus(Mandarine.MandarineMVC.HttpStatusCode.OK)
export class MyController {
}

Last updated