Skip to content

Taxum / @taxum/core / middleware/set-status / SetStatusLayer

Class: SetStatusLayer

Defined in: middleware/set-status.ts:19

A layer that sets a specific HTTP status code to the response.

Example

ts
import { StatusCode } from "@taxum/core/http";
import { SetStatusLayer } from "@taxum/core/middleware/set-status";
import { m, Router } from "@taxum/core/routing";

const router = new Router()
    .route("/", m.get(() => "Hello World))
    .layer(new SetStatusLayer(StatusCode.ACCEPTED));

Implements

Constructors

Constructor

new SetStatusLayer(status): SetStatusLayer

Defined in: middleware/set-status.ts:27

Creates a new SetStatusLayer.

Parameters

status

StatusCode

the status to set responses to.

Returns

SetStatusLayer

Methods

layer()

layer(inner): HttpService

Defined in: middleware/set-status.ts:31

Wrap the given service with the middleware, returning a new service that has been decorated with the middleware.

Parameters

inner

HttpService

Returns

HttpService

Implementation of

Layer.layer