aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/createProviderMiddleware.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts/lib/createProviderMiddleware.js')
-rw-r--r--app/scripts/lib/createProviderMiddleware.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/scripts/lib/createProviderMiddleware.js b/app/scripts/lib/createProviderMiddleware.js
new file mode 100644
index 000000000..6dd192411
--- /dev/null
+++ b/app/scripts/lib/createProviderMiddleware.js
@@ -0,0 +1,13 @@
+
+module.exports = createProviderMiddleware
+
+// forward requests to provider
+function createProviderMiddleware({ provider }) {
+ return (req, res, next, end) => {
+ provider.sendAsync(req, (err, _res) => {
+ if (err) return end(err)
+ res.result = _res.result
+ end()
+ })
+ }
+} \ No newline at end of file