Next.js Discord

Discord Forum

Api route handler

Answered
wWHYSOSERIOUSs posted this in #help-forum
Open in Discord
im using a GET, POST, PATCH... pattern while defining my api routes in the route.ts but in docs im seeing handler function , can someone explain me if im using the outdated or the docs in seeing is outdated ?
Answered by joulev
GET/POST/PATCH are for the app router

handler() and res.json() are for the pages router
View full answer

4 Replies

Answer
can you please give me docs for app and pagerouter , i cant find i guess
@wWHYSOSERIOUSs can you please give me docs for app and pagerouter , i cant find i guess
use this dropdown at the top left to switch between pages and app router documentations
ty sooo much bro u saved my life ;-;