Next.js Discord

Discord Forum

Usage of API routing w/ Next.js 13+

Unanswered
English Angora posted this in #help-forum
Open in Discord
English AngoraOP
Dear forum,

I have been struggling a bit with the docs of Next.js, regarding "routing/api-routes". https://nextjs.org/docs/pages/building-your-application/routing/api-routes

Did anyone else experience any form of struggle regarding these docs? I am wondering if anyone found any other great or better source on how to work with this "/routing/api-routes/"?

Overall I am trying to get this communicating with Google's "Firestore database".

My specific question is how would I be able to create a new page "flow" with the use of Next's "/routing/api-routes/", as shown in the image?

Thank you so much.

Best regards.

Paddy

2 Replies

Firstly are you using pages router or app router??

Since you sent the docs regarding pages router i would assume that but just in case.
Secondly, i would say the docs are quite clear?

I dont know what you mean by flow and all but api routes are just REST api endpoints.

You create them inside /pages/api, and then fetch them using the fetch api. Simple as that