diff --git a/bin/lamassu-server b/bin/lamassu-server index 0fa31408..a41632ec 100755 --- a/bin/lamassu-server +++ b/bin/lamassu-server @@ -16,7 +16,7 @@ if (!httpOnly) { try { options.https = { key: fs.readFileSync(options.certKeyPath), - cert: fs.readFileSync(options.certPath), + cert: fs.readFileSync(options.certPath) } } catch (err) { console.log('Please configure your certificate.') diff --git a/lib/routes.js b/lib/routes.js index 9fffb710..6c6e3d47 100644 --- a/lib/routes.js +++ b/lib/routes.js @@ -121,6 +121,7 @@ function poll (req, res) { } function trade (req, res, next) { + console.log('DEBUG24') const tx = req.body tx.cryptoAtoms = new BigNumber(tx.cryptoAtoms) @@ -218,11 +219,7 @@ function updatePhone (req, res) { function fetchPhoneTx (req, res) { return plugins.fetchPhoneTx(req.query.phone) - .then(r => res.json(r)) - .catch(err => { - logger.error(err) - res.sendStatus(500) - }) + .then(r => res.json(r)) } function registerRedeem (req, res) { @@ -259,6 +256,8 @@ function isUniqueViolation (err) { } function cacheAction (req, res, next) { + console.log('DEBUG22: %s', req.path) + const sql = `insert into idempotents (request_id, device_id, body, status, pending) values ($1, $2, $3, $4, $5)` @@ -302,7 +301,7 @@ function cacheAndRespond (req, res, _body, _status) { const body = _body || {} return updateCachedAction(req, body, status) - .then(() => res.status(status).json(body)) + // .then(() => res.status(status).json(body)) } function httpError (msg, code) { diff --git a/package.json b/package.json index b3efc584..1ef22990 100644 --- a/package.json +++ b/package.json @@ -59,5 +59,7 @@ "scripts": { "test": "mocha --recursive test" }, - "devDependencies": {} + "devDependencies": { + "http-proxy": "^1.15.2" + } } diff --git a/todo.txt b/todo.txt index 866885b7..b8ac027b 100644 --- a/todo.txt +++ b/todo.txt @@ -114,3 +114,7 @@ v need to create CA: http://stackoverflow.com/questions/19665863/how-do-i-use-a- v consistent error handling v usage of http status codes (good for got) v finish idempotency for all calls + +------------- + +test pending action (action needs to take a while so we can test)