WIP
This commit is contained in:
parent
06ff037189
commit
745eb225df
4 changed files with 13 additions and 8 deletions
|
|
@ -16,7 +16,7 @@ if (!httpOnly) {
|
||||||
try {
|
try {
|
||||||
options.https = {
|
options.https = {
|
||||||
key: fs.readFileSync(options.certKeyPath),
|
key: fs.readFileSync(options.certKeyPath),
|
||||||
cert: fs.readFileSync(options.certPath),
|
cert: fs.readFileSync(options.certPath)
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Please configure your certificate.')
|
console.log('Please configure your certificate.')
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,7 @@ function poll (req, res) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function trade (req, res, next) {
|
function trade (req, res, next) {
|
||||||
|
console.log('DEBUG24')
|
||||||
const tx = req.body
|
const tx = req.body
|
||||||
tx.cryptoAtoms = new BigNumber(tx.cryptoAtoms)
|
tx.cryptoAtoms = new BigNumber(tx.cryptoAtoms)
|
||||||
|
|
||||||
|
|
@ -219,10 +220,6 @@ function updatePhone (req, res) {
|
||||||
function fetchPhoneTx (req, res) {
|
function fetchPhoneTx (req, res) {
|
||||||
return plugins.fetchPhoneTx(req.query.phone)
|
return plugins.fetchPhoneTx(req.query.phone)
|
||||||
.then(r => res.json(r))
|
.then(r => res.json(r))
|
||||||
.catch(err => {
|
|
||||||
logger.error(err)
|
|
||||||
res.sendStatus(500)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerRedeem (req, res) {
|
function registerRedeem (req, res) {
|
||||||
|
|
@ -259,6 +256,8 @@ function isUniqueViolation (err) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function cacheAction (req, res, next) {
|
function cacheAction (req, res, next) {
|
||||||
|
console.log('DEBUG22: %s', req.path)
|
||||||
|
|
||||||
const sql = `insert into idempotents (request_id, device_id, body, status, pending)
|
const sql = `insert into idempotents (request_id, device_id, body, status, pending)
|
||||||
values ($1, $2, $3, $4, $5)`
|
values ($1, $2, $3, $4, $5)`
|
||||||
|
|
||||||
|
|
@ -302,7 +301,7 @@ function cacheAndRespond (req, res, _body, _status) {
|
||||||
const body = _body || {}
|
const body = _body || {}
|
||||||
|
|
||||||
return updateCachedAction(req, body, status)
|
return updateCachedAction(req, body, status)
|
||||||
.then(() => res.status(status).json(body))
|
// .then(() => res.status(status).json(body))
|
||||||
}
|
}
|
||||||
|
|
||||||
function httpError (msg, code) {
|
function httpError (msg, code) {
|
||||||
|
|
|
||||||
|
|
@ -59,5 +59,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "mocha --recursive test"
|
"test": "mocha --recursive test"
|
||||||
},
|
},
|
||||||
"devDependencies": {}
|
"devDependencies": {
|
||||||
|
"http-proxy": "^1.15.2"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
4
todo.txt
4
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 consistent error handling
|
||||||
v usage of http status codes (good for got)
|
v usage of http status codes (good for got)
|
||||||
v finish idempotency for all calls
|
v finish idempotency for all calls
|
||||||
|
|
||||||
|
-------------
|
||||||
|
|
||||||
|
test pending action (action needs to take a while so we can test)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue