Dealing with a database with Next.js API routes