|
|
@@ -18,42 +18,42 @@ app.use(function (req, res, next) { |
|
|
|
next() |
|
|
|
}) |
|
|
|
|
|
|
|
app.get('/help', function (req, res, next) { |
|
|
|
app.get('/help', function (req, res) { |
|
|
|
res.send('https://github.com/binhonglee/Breakups') |
|
|
|
}) |
|
|
|
|
|
|
|
app.post('/total', function (req, res, next) { |
|
|
|
app.post('/total', function (req, res) { |
|
|
|
input = req.body |
|
|
|
var toReturn = { 'total': 0 } |
|
|
|
toReturn.total = total(input.users) |
|
|
|
res.json(toReturn) |
|
|
|
}) |
|
|
|
|
|
|
|
app.post('/perPerson', function (req, res, next) { |
|
|
|
app.post('/perPerson', function (req, res) { |
|
|
|
input = req.body |
|
|
|
var toReturn = { 'perPerson': 0 } |
|
|
|
toReturn.perPerson = (total(input.users)) / input.users.length |
|
|
|
res.json(toReturn) |
|
|
|
}) |
|
|
|
|
|
|
|
app.post('/oweChart', function (req, res, next) { |
|
|
|
app.post('/oweChart', function (req, res) { |
|
|
|
input = req.body |
|
|
|
input.users = oweChart(input.users) |
|
|
|
res.send(input) |
|
|
|
}) |
|
|
|
|
|
|
|
app.post('/sortedOweChart', function (req, res, next) { |
|
|
|
app.post('/sortedOweChart', function (req, res) { |
|
|
|
input = req.body |
|
|
|
input.users = mergeSort(oweChart(input.users)) |
|
|
|
res.send(input) |
|
|
|
}) |
|
|
|
|
|
|
|
app.post('/paymentChain', function (req, res, next) { |
|
|
|
app.post('/paymentChain', function (req, res) { |
|
|
|
input = req.body |
|
|
|
res.json(paymentChain(mergeSort(oweChart(input.users)))) |
|
|
|
}) |
|
|
|
|
|
|
|
app.post('/emailPaymentChain', function (req, res, next) { |
|
|
|
app.post('/emailPaymentChain', function (req, res) { |
|
|
|
input = req.body |
|
|
|
MIXMAX_API_KEY = input['mixmax-api'] |
|
|
|
var sorted = mergeSort(oweChart(input.users)) |
|
|
|