Merge branch 'v5' into v5

This commit is contained in:
Josh Harvey 2017-08-30 16:51:10 +03:00 committed by GitHub
commit d254e28e96
15 changed files with 2223 additions and 1468 deletions

View file

@ -15,6 +15,7 @@ const plugins = require('./plugins')
const helpers = require('./route-helpers')
const poller = require('./poller')
const Tx = require('./tx')
const E = require('./error')
const customers = require('./customers')
const argv = require('minimist')(process.argv.slice(2))
@ -109,6 +110,10 @@ function postTx (req, res, next) {
return res.json(tx)
})
.catch(err => {
if (err instanceof E.StaleTxError) return res.status(404).json({})
throw err
})
.catch(next)
}
@ -289,7 +294,11 @@ app.get('/tx/:id', getTx)
app.get('/tx', getPhoneTx)
app.use(errorHandler)
app.use((req, res) => res.status(404).json({error: 'No such route'}))
app.use((req, res) => {
console.log('DEBUG98')
console.log(req.route)
res.status(404).json({error: 'No such route'})
})
localApp.get('/pid', (req, res) => {
const deviceId = req.query.device_id