Mandarine.TS
Latest
Latest
  • Mandarine.TS
  • Getting started
    • Installing Deno Runtime
    • Setting up Environment
    • Quick Example
  • Concepts
  • Mandarine Project Structure
  • Mandarine CLI
    • CLI Reference
      • mandarine new
      • mandarine generate
      • mandarine run
  • Mandarine Core
    • Core Initialization
    • Mandarine.json
    • Dot env file
    • Properties
      • The @Value Decorator
    • Components
      • Controller
      • Middleware
      • Repository
      • Component
      • Service
      • Configuration
      • Manual Component
    • Dependency Injection
      • Accessing DI container
    • Resource Handlers
      • Resource Handler Registry
      • Resource Handler
      • Resource Resolver
  • Mandarine MVC
    • Web MVC
    • Controllers
      • Routes
        • Parameterized Routes
      • HTTP Handlers
      • @ResponseStatus
    • Custom Middleware
    • Session Middleware
    • CORS Middleware
    • Template Engine
      • @Render Decorator
      • Accessing data from template
    • Launching web-app
    • Serving Static Content
    • Multipart Form Data
  • Mandarine Security
    • Sessions
  • Mandarine Data
    • ORM
      • Data source
      • Models
      • Repositories
        • Interacting with data
        • Updating data
    • Mandarine Query Language
  • Resources
    • Changelog
  • Plugins
    • Optional
    • Promise Repeater
Powered by GitBook
On this page
  • Main
  • Usage

Was this helpful?

  1. Mandarine MVC
  2. Controllers

@ResponseStatus

PreviousHTTP HandlersNextCustom Middleware

Last updated 4 years ago

Was this helpful?

Main

As we have described , 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 {
}
before