npm

@mewhhaha/little-router-plugin-data
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

little-router-plugin-data

This is a plugin for little-router that allows you to specify what kind of JSON body should be passed with the request.

Example

import { data_ } from "@mewhhaha/little-router-plugin-data";
import { type } from "arktype";
import { Router } from "@mewhhaha/little-router";
import { json } from "@mewhhaha/typed-response";

const router = Router().post(
  "/a",
  [data_(type({ value: "'hello'" }))],
  ({ data }) => {
    return text(200, data.value);
  }
);

Readme

Keywords

none

Package Sidebar

Install

npm i @mewhhaha/little-router-plugin-data

Weekly Downloads

14

Version

1.0.5

License

MIT

Unpacked Size

14.1 kB

Total Files

5

Last publish

Collaborators

  • mewhhaha