You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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? 😂
Summary
Basically switching from
pages/api
toapp/api
. They do the same thing, but the new app directory is much better (see below why).Why
app
router (app
router now uses more standard APIs instead of using proprietary APIs in prevpages
router)GET
endpoint? Create aGET()
function. Need aPOST/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
The text was updated successfully, but these errors were encountered: