This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Router.route('/hello/:param', function(){ | |
this.render('home'); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Router.route('/files/:file(*)', { | |
action: function(){ | |
this.render('home'); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Router.route('myRoute', { | |
path: '/files/:file(*)', | |
action: function(){ | |
this.render('home'); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Router.map(function(){ | |
this.route('route1', { | |
path: '/', | |
template: 'subscriptions', | |
action: function(){ | |
this.render(); | |
} | |
}); | |
this.route('route2', { | |
path: '/files/*', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Router.map(function(){ | |
this.route('subscriptions', { | |
path: '/' | |
}); | |
this.route('home', { | |
path: '/files/:file(*)' | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ensure that the user does not put in too many '/' and ensures that only | |
//underground blips can be subblips of underground blips. | |
cleanPath = function(path){ | |
return path.split('/').reduce(function(prev,curr){ | |
if (curr!=''){ | |
if (prev.search('_')>-1){ | |
if (curr.search('_')>-1){ | |
return prev+=curr+'/'; | |
} else { | |
return prev+='_'+curr+'/'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//all of this code is in a function. | |
var docs = Meals.aggregate(pipeline) | |
var oldData = Cache.regulars.data | |
var newData = {}; | |
docs.forEach(function(doc){ | |
var id = doc._id | |
var raw = _.omit(doc,'_id'); | |
newData[id] = raw | |
var oldDoc = oldData[id] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Messages } from "./Notifications.js" //import | |
//uses AWS SNS under the hood for all payload delivery | |
//send a push notification | |
//will determine whether or not to send to android or ios automatically. | |
Messages.send({ | |
title: "This is a short Title", | |
text: "This is the body of the message and is expected to be more detailed and most likely longer...", | |
users: ["userId1", "userId2", ...], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Messages } from "./Notifications.js" //import | |
//uses AWS SNS under the hood for all payload delivery | |
//send a push notification | |
//will determine whether or not to send to android or ios automatically. | |
Messages.send({ | |
title: "This is a short Title", | |
text: "This is the body of the message and is expected to be more detailed and most likely longer...", | |
users: ["userId1", "userId2", ...], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
send(m){ | |
if (m.numbers){ | |
m.numbers.forEach((number)=>{ | |
this._sendSMS(m.text, number); | |
}) | |
} else { | |
let sentTo = []; | |
Devices.find({userId: {$in: m.users}}).forEach((device) => { | |
const devId = this._sendNotification(device, m.title, m.text, m.data); | |
devId && sentTo.push(devId) |