Skip to content

Instantly share code, notes, and snippets.

View MiguelCedric's full-sized avatar

Miguel MiguelCedric

View GitHub Profile
@MiguelCedric
MiguelCedric / archive-ride.js
Created March 8, 2018 20:51
Archive ride job
// Sendgrid API
const sgMail = require('@sendgrid/mail');
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
const MongoClient = require('mongodb').MongoClient;
module.exports = function(agenda) {
agenda.define('archive ride', function(job, done) {
// Connect to the db
@MiguelCedric
MiguelCedric / agenda.js
Created March 8, 2018 20:45
Agenda Configuration
const Agenda = require('agenda');
const mongoConnectionString = 'mongodb://localhost:27017/yourdatabase';
// or override the default collection name:
let agenda = new Agenda({db: {address: mongoConnectionString, collection: 'jobs'}});
let jobTypes = process.env.JOB_TYPES ? process.env.JOB_TYPES.split(',') : [];
jobTypes.forEach(function(type) {