This is a psuedo-code demo of a Next.js API route running as a Background Function on Netlify.
Find the code in batch-process.js which mocks generating invoices, creating PDFs and sending emails in a synchronous queue.
Add the following code to any API route in a Next.js project running on Netlify.
export const config = {
type: "experimental-background",
};