Typebox

A type checker for JSON like objects from the request.

Examples

Using create-vixeny

Vanilla installation

Here a way to set up your plugin.

import { wrap } from "vixeny";
import { options, request } from "./setup.ts";

const serve = wrap(options)()
  .stdPetition({
    path: "/hi",
    method: "POST",
    f: ({ typebox }) => typebox?.user ? typebox.user.userId : null,
  })
  .compose();

const response = await serveMock(request);
const body = await response.text();

console.log(
  // 50
  body,
);