Skip to content

Instantly share code, notes, and snippets.

@benjaminudoh10
Last active January 4, 2023 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benjaminudoh10/ac2f9367a0f297c5987e1c1bded8a361 to your computer and use it in GitHub Desktop.
Save benjaminudoh10/ac2f9367a0f297c5987e1c1bded8a361 to your computer and use it in GitHub Desktop.
Bullqueue blog - Add endpoint for processing payment
import express, { Request, Response } from 'express';
const app = express();
...
app.post('/process-payment', (request: Request, response: Response) => {
const { cardNumber, cvv, cardExpiry } = request.body;
const queue = new QueueService().getQueue(Queues.DEFAULT);
// add job to queue
queue.add(JobType.PROCESS_PAYMENT, { cardNumber, cvv, cardExpiry });
return response
.status(200)
.json({
message: 'Card charge in progress, you will be notified once complete',
})
.end();
});
export { app };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment