Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a simpler route declaration syntax, aimed at compatibility #86

Closed
wants to merge 1 commit into from

Conversation

swain
Copy link
Contributor

@swain swain commented Oct 31, 2023

Motivation

This PR introduces a simplified syntax for declaring routes:

const router = createCompatRouter({
  introspection: undefined,
  using: new Router(),
})
  .post(
    '/items',
    {
      name: 'createItem',
      request: z.object({ id: z.string() }),
      response: z.object({ id: z.string() }),
    },
    (ctx) => {
      // implementation
    },
  )
  .get(
    '/items/:id',
    {
      name: 'getItemById',
      request: z.object({ filter: z.string() }),
      response: z.object({ id: z.string() }),
    },
    (ctx) => {
      // implementation
    },
  );

@swain swain force-pushed the compat-router branch 2 times, most recently from 8599096 to 244d626 Compare November 1, 2023 00:16
@swain swain changed the title Try out a new route declaration syntax, aimed at compatibility Introduce a simpler route declaration syntax, aimed at compatibility Nov 5, 2023
@swain swain closed this Nov 6, 2023
@swain swain deleted the compat-router branch November 6, 2023 16:08
@swain swain restored the compat-router branch January 10, 2024 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant