I spent the time making the decisions so you don't have to.
You can read the docs folder or the web version
class Auth {
@post('/auth/signup')
async signup(req, res) {
// handler
}
}
class User {
@post('/user/invite')
sendInvite(req, res) {
const email = req.body.email
req.pushToQueue('email', {
email,
type: 'invite',
})
}
}
// jobs/email.queue.ts
class EmailQueueHandler {
@listen('email', 'invite')
handleInviteJob(job) {
// Called from the worker
// process the job
}
}
/**
*
* GET /api/ping
* @summary quickly check if the server is running or not
* @returns 200 - success - application/json
*/
@get('/api/ping')
ping(req: Request, res: Response) {
req.pushToQueue('test', {
type: '',
})
return res.send({
success: true,
now: new Date().toISOString(),
})
}
Various reasons...., this might be relevant