Does transformProps in Pages work similarly to getServerSideProps in Next.js?

Hello,

In my current Pages project, I have some code I’d like to run server-side each time a certain page is requested to avoid sensitive data being exposed to the client.

My initial thought was a serverless function but I don’t want to expose the functionality as a public endpoint. I’m wondering if transformProps might work for this use case.

Does transformProps work similarly to getServerSideProps in Next.js? If not, are there recommended best practices for executing code server-side during page load without exposing a public http endpoint?

Thanks!
DJ