Skip to main content
Module

x/acorn/handlers.ts>immutable

A focused RESTful server framework for Deno 🌰🦕
Go to Latest
function immutable
import { immutable } from "https://deno.land/x/acorn@0.3.0/handlers.ts";

Intended to provide an immutable response handler for a route.

The response value is used as the body of the response and cache control headers are set to indicate that the value is immutable.

Example

import { Router, immutable } from "https://deno.land/x/acorn/mod.ts";

const router = new Router();

router.all("/", immutable({ hello: "world" }));

router.listen({ port: 8080 });

Type Parameters

R extends string
BodyType
Params extends RouteParameters<R>
ResponseType

Parameters

response: ResponseType

the value which will be returned to the client as "immutable"

optional
options: RouteOptions<R, BodyType, Params>

Additional options which are used in conjunction with the route.

Returns

a handler with options passed through