-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathexample.js
More file actions
41 lines (30 loc) · 853 Bytes
/
example.js
File metadata and controls
41 lines (30 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
'use strict'
const path = require('path')
const createGrapes = require('./grapes')
const createWorker = require('./worker')
const createClient = require('./client')
const grapes = createGrapes()
;(async () => {
await grapes.start()
const worker = createWorker({
env: 'development',
wtype: 'wrk-util-net-api',
apiPort: 8721,
serviceRoot: path.join(__dirname, '..', 'bfx-util-net-js')
}, grapes)
await worker.start()
console.log('worker started, announcing on grape')
// you can also pass 'rest:util:net'
const client = createClient(worker)
const res = await client.request({
action: 'getIpGeo',
args: ['8.8.8.8']
})
console.log('got response:')
console.log(res)
await client.stop()
console.log('client stopped')
await worker.stop()
console.log('worker stopped')
await grapes.stop()
})()