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

Investigate supporting Route Handlers #2

Open
EskiMojo14 opened this issue Feb 19, 2023 · 0 comments
Open

Investigate supporting Route Handlers #2

EskiMojo14 opened this issue Feb 19, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@EskiMojo14
Copy link
Collaborator

EskiMojo14 commented Feb 19, 2023

https://beta.nextjs.org/docs/routing/route-handlers

this is in Canary so it's probably not worth investing a lot of time into until the API is more solidified, but as it stands CEF could be beneficial for these.

something like

// file: app/foo/route.ts

import { createEndpoint } from "src/server";

const endpoint = createEndpoint.route({
  methods: ({ method }) => ({
    get: method<string>({
      handler: () => 'foo',
    })
  })
});

export const { GET } = endpoint.methods;

could work.

the main pain point would be working out how to allow passing ResponseInit properties, now that there's no res passed to the handler.

@EskiMojo14 EskiMojo14 added the enhancement New feature or request label Feb 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant