Answer the question
In order to leave comments, you need to log in
NextJs - direct access to the database or through the API?
NextJs allows you to directly access the database directly from the page (page). Is there a reason to access the database through the API?
Less than one week experience with NextJs. I liked the fact that you can directly (mysql2) access the database, but I thought about how not to run into pitfalls in the future.
Answer the question
In order to leave comments, you need to log in
An important principle is that after server rendering, client rendering must continue to be processed according to the same logic, therefore, even with SSR, direct access to the database is at least not safe.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question