hello!
Netlify handles Next.js API routes the same as other routes, so they don't generate different serverless functions. if you want to customize your serverless functions, you can put them in netlify/functions/whatever-you-want.js
to mimic the /api/* pattern, you can add this to your netlify.toml:
[[redirects]]
from = "/api/*"
to = "/.netlify/functions/:splat"
status = 200
that would let you call example.com/api/whatever-you-want to reach your serverless function
for Middleware, we currently handle those requests at our origin. Matt Kane (who knows far more about this than I do) wrote up details here: github.com/netlify/netlify-plugin-nextjs/blob/mai…
thanks!