Server Compenents, Route Handlers or API routes #75733
Unanswered
mtbspace
asked this question in
App Router
Replies: 1 comment 1 reply
-
|
API routes are a Pages Router thing. In App Router, to make an endpoint, that's not specialized like a Server Action/Function, you have to use Route Handlers, which have a significantly different API than the Page's Router API Routes. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've completed the tutorial and am now building an app. The tutorial made no mention of API routes as far as I can recall, and the documentation on API routes states 'If you are using the App Router, you can use Server Components or Route Handlers instead of API Routes.'
Should I be taking that as a recommendation, and, rather than using API routes, should I be using Server Components and/or Route Handlers as being the best pattern to work with NextJS in new projects?
Beta Was this translation helpful? Give feedback.
All reactions