Skip to content

Latest commit

 

History

History
20 lines (16 loc) · 524 Bytes

File metadata and controls

20 lines (16 loc) · 524 Bytes

little-router-plugin-query

This is a plugin for little-router that allows you to specify query params that should or could be passed along with the request.

Example

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

const router = Router().get(
  "/a",
  [query_(type({ hello: "'world'" }))],
  ({ query: { hello } }) => {
    return json(200, hello);
  }
);