-
-
Save kylebrowning/2b1b5d48e2d8bafe59b869a6533a9d9e to your computer and use it in GitHub Desktop.
This file contains 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.get("push") { req -> String in | |
let devices = Device.query(on: req).all().map({ (devices) -> [Device] in | |
try devices.forEach({ (device) in | |
let temp = try req.make(APNS.self) | |
let alert = Alert(title: "Hey There", subtitle: "Subtitle", body: "Body") | |
let aps = Aps(alert: alert, category: nil, badge: 1) | |
let new = try temp.send(deviceToken: device.deviceToken, aps: aps, group: req.eventLoop) | |
}) | |
return devices | |
}) | |
return "Pushed to everyone!!" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment