Do you need Nginx / Apache for deploying an API?
IMO, you'll want a web server. Web servers are completely capable of running code behind the requests they process. Your preconception that only static content is served from web servers is not the case for most installations today. Safe to say, every modern web site is serving up content from a dynamic source using a web server to host the application.
While some languages have built-in web servers, they will likely not be as robust or secure or feature rich, as modern web servers.