summaryrefslogtreecommitdiffstats
path: root/examples/request.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--examples/request.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/examples/request.js b/examples/request.js
new file mode 100644
index 0000000..1b03254
--- /dev/null
+++ b/examples/request.js
@@ -0,0 +1,18 @@
+'use strict'
+
+const { request } = require('../')
+
+async function main () {
+ const {
+ statusCode,
+ headers,
+ body
+ } = await request('http://localhost:3001/')
+
+ const data = await body.text()
+ console.log('response received', statusCode)
+ console.log('headers', headers)
+ console.log('data', data)
+}
+
+main()