In my NextJS project, there is a setInterval function in airdropLoop.ts that I would like to automatically run after next dev or next start is called. Is this possible?
Edit: My NextJS project is for public APIs only, so there are no client pages / ability to run useEffect()/getServerSideProps(). The tl;dr is that one of my public endpoints simply adds items to a DB. The airdropLoop.ts should be running in the background every minute and checking if new items have been added. I want it to happen on a loop because it will be more efficient to wait for the DB to fill up a bit than running a function anytime something is added to the DB. I would rather not use a cron job.