in next.js, we can use
getStaticProps (Static Generation): Fetch data at build time.
getStaticPaths (Static Generation): Specify dynamic routes to pre-render based >on data.
getServerSideProps (Server-side Rendering): Fetch data on each request.
to run serverside code , but in order to do that , i need to import serverside module in that script ,for example, i want to import an authentication module to check user is genuine or not in getserversideprops . (or database schemas, for example, mongoose)
Since i cannot import in an function , i have to import on the top of the file which means that anyone can see that import and see how i authenticate user .....
example:
import a from 'auth"
getserversideprops(){
if(a(req) ==true) ...
}