How to set up nextjs api route?

Im using apollo-server-micro. Im having problems with apollo studio reaching my api. I either get a cors error and when I set up cors I get a “called start() with surprising state started” error. Hope you can help me with the setup or provide an example code. Im using apollo-server-micro 3.0.1