1.0.1 • Published 11 months ago

elysia-dynamic-route v1.0.1

Weekly downloads
-
License
-
Repository
gitlab
Last release
11 months ago

Elysia-Dynamic-Route

Getting started

bun a elysia-dynamic-route
npm i elysia-dynamic-route
yarn add elysia-dynamic-route
pnpm add elysia-dynamic-route

Usage

import { DynamicRoute, methodSchema } from "./DynamicRoute"

new Elysia()
  .use(
    DynamicRoute(undefined, {
      name: "a_route",
      group_path: "/a",
      swaggerParams: {},
    })
  )
  .post("/", ({ a_route }) => {
    const conf = {
      method,
      path: `/${path}`,
      handler: ({ body: {} }) => ({ xxx: `/${path}` }),
      hook: {
        body: t.Object({
          path: t.String(),
          method: methodSchema,
        }),
      },
    }
    return a_route(conf)
  })
1.0.1

11 months ago