How to use getServerSideProps with Next.js for SSR (server side rendering)

The getServerSideProps function is executed before the page is loaded and allows you to make calls to your APIs before rendering the page. You can retrieve the context of the request and modify the response if needed. For example to return status codes different from 200, ideal to manage your 404s properly. You are obliged to return props in this function.
export async function getServerSideProps(context) {
  return {
    props: {},