Authentication
curl --location 'http://localhost:8080/queues/my-test-queue/jobs' \
--header 'Authorization: Bearer 1234'const http = require('node:http');
// Create an HTTP server
const server = http.createServer((req, res) => {
const { job, token } = JSON.parse(req.body);
// Do something with the job
await doSomething(job);
// Update progress to 100
const updateProgress = await fetch(`http://localhost:8080/queues/my-test-queue/jobs/${job.id}/progress`, {
method: 'POST',
body: JSON.stringify(100),
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
}
});
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify('job-result'));
});
Last updated