secure API using middleware | NextJS - Theo's Typesafe Cult