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

Migrate to Route Handlers from API Routes #83

Open
aryanprince opened this issue Nov 21, 2023 · 0 comments
Open

Migrate to Route Handlers from API Routes #83

aryanprince opened this issue Nov 21, 2023 · 0 comments
Assignees
Labels
🚚 api - nextjs routes ♻️ refactor Neither fixes a bug nor adds a feature

Comments

@aryanprince
Copy link
Member

aryanprince commented Nov 21, 2023

Summary

Basically switching from pages/api to app/api. They do the same thing, but the new app directory is much better (see below why).

Why

  • There's lotta new features
  • Better web standards being maintained in the new app router (app router now uses more standard APIs instead of using proprietary APIs in prev pages router)
  • Easy to set up different REST API endpoints just by using functions with verbs as names. Need a GET endpoint? Create a GET() function. Need a POST/PUT/DELETE endpoint? Create a function with that name, that's it.

Basically the app router is the future of Next.js and it would be awesome if we could migrate.

Shouldn't be that complex of a migration, compared to the nightmare of switching the 'frontend' code to app router, remember that big PR (#36) I made few weeks ago? 😂

Links to Docs

Our existing API Routes: Pages Router - API Routes

New API Route Handlers: App Router - Route Handlers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚚 api - nextjs routes ♻️ refactor Neither fixes a bug nor adds a feature
Projects
None yet
Development

No branches or pull requests

3 participants