Proving $|f(z)|$ is constant on the boundary of a domain implies $f$ is a constant function
By the maximum modulus principle, $f$ takes its maximum modulus on the boundary. By the minimum modulus principle (which is just the maximum modulus principle applied to $1/f$, which requires that $f$ have no zeros), $f$ also takes its minimum modulus on the boundary.
If the modulus is constant on the boundary, then the minimum modulus and the maximum modulus, both lying on the boundary, must be equal. Hence the modulus is constant on all of $D$ including the interior.
And if $|f|$ is constant on all of $D$, say $|f|(D)=\{K\}$, then the image of $D$ under $f$ lies inside the circle $\{e^{iθ}K\}.$ A circle which has empty interior in $\mathbb{C},$ so is not open.
But the open mapping theorem states that if a function $f$ is not constant, it must be an open map, i.e. it must send any open subset of $\mathbb{C}$ to an open subset.
Finally, by contraposition, since $f(D)\subseteq \{e^{iθ}K\}$ is not open, $f$ must be constant.
Consider $\frac{1}{f(z)}$. $\phantom{}$