Skip to main content
Module

x/acorn/mod.ts>RouteOptions

A focused RESTful server framework for Deno 🌰🦕
Go to Latest
interface RouteOptions
import { type RouteOptions } from "https://deno.land/x/acorn@0.4.0/mod.ts";

Options that can be specified when adding a route to the router.

Type Parameters

R extends string
BodyType
Params extends RouteParameters<R>

Properties

optional
deserializer: Deserializer<BodyType, Params>

An optional deserializer to use when decoding the body. This can be used to validate the body of the request or hydrate an object.

optional
errorHandler: ErrorHandler

An error handler which is specific to this route, which will be called when there is an error thrown when trying to process the route.

optional
serializer: Serializer<Params>

The serializer is used to serialize a return value of the route handler, when the value is not a Response or BodyInit. The optional .stringify() method of the serializer is expected to return a JSON string representation of the body returned from the handler, where as the .toResponse() method is expected to return a full Response object.