forked from phnz/vpnht-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.js
More file actions
26 lines (22 loc) · 673 Bytes
/
Copy pathclient.js
File metadata and controls
26 lines (22 loc) · 673 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
var assert = require('assert');
var restify = require('restify');
var client = restify.createStringClient({
url: 'http://localhost:1234',
});
client.basicAuth('API_KEY', 'API_SECRET');
// add new user
client.post('/user', {
username: 'david1',
password: 'test123',
expiration: '2016/10/08 19:30:00'
}, function (err, req, res, obj) {
console.log('Server returned: %j', obj);
});
// update TTL
//client.put('/user/david', { expiration: 478568425 }, function (err, req, res, obj) {
// console.log('Server returned: %j', obj);
//});
// delete user 'david'
//client.del('/user/david', function (err, req, res, obj) {
// console.log('Server returned: %j', obj);
//});