Skip to main content

Nuxt.js

api/someQueue.js
import { Queue } from "quirrel/nuxt";

export default Queue(
"someQueue",
async (job, meta) => {
// do something
}
);
nuxt.config.js
export default {
serverMiddleware: [
// will register the queue with Nuxt
"~/api/someQueue.js",
]
}

Creates a new Queue. Make sure to export it from a Server Middleware, otherwise it won't work.

Parameters

function Queue<T>(
path: string,
worker: (job: T, meta: JobMeta): Promise<void>,
defaultJobOptions?: { exclusive?: boolean }
): QueueInstance<T>
ParameterUsage
pathThe route that this queue is reachable at.
workera function that takes the job's payload and returns a Promise
defaultJobOptionsOptional. Use to set default options applied to every job.