I'm a react developer and I would like to learn backend (MERN stack). Before I learn Node, Express and Mongo DB (backend) which I can use with react (front-end) I explored Next JS a little bit(very little). I got to know Next JS is great and we can build the back-end in the Next JS app itself, I have a couple of questions here.
Let's say if I build a backend with Express and MongoDB to use in my React project, I can very well use the same backend to build my mobile app using the react-native app. However, if I use Next JS and build a backend within the same app then how can I use this backend built inside Next JS within my React-Native app?
Can I use already existing API like weather API/ currency converter API inside my Next JS app?
Sorry if this question is too silly.
Yes! you could build your App's backend in Nextjs itself. Nextjs uses file-based routing. So, any file inside the folder pages/api is mapped to /api/* and will be treated as an API endpoint.
For example, when you create a file 'people.js' inside folder 'pages/api', it will be treated as an endpoint and you could access the endpoint by calling your_domain.com/api/people
Also, you can use external APIs in your app just like you do in other react apps.