From 08f15d8807025d2554330b3e543ccf589ee62ebb Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Fri, 23 Dec 2016 17:03:42 +0700 Subject: [PATCH] Add usage section to readme --- README.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/README.md b/README.md index 6c8c88c..4742510 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,43 @@ Client library for the Tor Onionoo API with backend agnostic caching. npm install --save onionoo ``` +## Usage + +```js +const Onionoo = require('onionoo'); +const onionoo = new Onionoo(); + +// Get top 10 relays +const query = { + limit: 10, + running: true, + order: '-consensus_weight' +}; + +onionoo.summary(query).then(response => { + console.log(response.body) + // { + // version:'3.1', + // relays_published:'2016-12-23 09:00:00', + // relays:[ + // [Object], + // [Object], + // [Object], + // [Object], + // [Object], + // [Object], + // [Object], + // [Object], + // [Object], + // [Object] + // ], + // bridges_published:'2016-12-23 07:41:03', + // bridges:[] + // } + } +}); +``` + ## License MIT © Luke Childs