summaryrefslogtreecommitdiff
path: root/sandbox/client.js
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/client.js')
-rw-r--r--sandbox/client.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/sandbox/client.js b/sandbox/client.js
new file mode 100644
index 0000000..9a18a69
--- /dev/null
+++ b/sandbox/client.js
@@ -0,0 +1,20 @@
+var axios = require('../index');
+
+var URL = 'http://127.0.0.1:3000/api';
+var BODY = {
+ foo: 'bar',
+ baz: 1234
+};
+
+function handleSuccess(data) { console.log(data); }
+function handleFailure(data) { console.log('error', data); }
+
+// GET
+axios.get(URL, { params: BODY })
+ .then(handleSuccess)
+ .catch(handleFailure);
+
+// POST
+axios.post(URL, BODY)
+ .then(handleSuccess)
+ .catch(handleFailure); \ No newline at end of file