diff options
| author | Adam Soltys <[email protected]> | 2017-04-14 19:56:41 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2017-04-14 19:56:41 -0700 |
| commit | 7c5601109ae170cacb8b0df936c97e4006adbb03 (patch) | |
| tree | 4aeb3346d33c5ae30c6b7e8ab7f22f5e079f3c53 /blockcypher.js | |
| parent | b7a4332e9487659532ea50cd8063d0cd44011dce (diff) | |
| download | coinos-server-7c5601109ae170cacb8b0df936c97e4006adbb03.tar.gz coinos-server-7c5601109ae170cacb8b0df936c97e4006adbb03.zip | |
server refactor and jwt auth
Diffstat (limited to 'blockcypher.js')
| -rw-r--r-- | blockcypher.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/blockcypher.js b/blockcypher.js new file mode 100644 index 00000000..91adbc10 --- /dev/null +++ b/blockcypher.js @@ -0,0 +1,17 @@ +const proxyMiddleware = require('http-proxy-middleware') +const proxyContext = '/blockcypher' + +const proxyOptions = { + target: 'https://api.blockcypher.com', + changeOrigin: true, + pathRewrite: { + '^/blockcypher/': '/' + }, + onProxyReq: function(proxyReq, req, res) { + var symbol + symbol = indexOf.call(proxyReq.path, '?') >= 0 ? '&' : '?' + return proxyReq.path += symbol + "token=" + config.blockcypher_token + } +} + +module.exports = proxyMiddleware(proxyContext, proxyOptions) |
