You should not fetch an API route from getStaticProps — instead, you can write the server-side code directly in getStaticProps.
above sentence is from official docs of next.js and i find it confusing.
is it saying that i shouldn't do ajax request to my restful api? (i m using node express app as backend).
i m new to next.js, before i was using react node app with mongodb as database. i used moongose package for database related queries.
if i am not supposed to do ajax request then how am i supposed to work with data fetching related thing? can i use moongose in frontend directly?
//the way i want to do
getStaticProps(){
//here i want to get data from database about posts
//fetch('some end point of my restful api'){...}
}
//the way i think official docs is telling me to do
getStaticProps(){
//query from database
}