-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgeoadd-example.js
More file actions
35 lines (30 loc) · 896 Bytes
/
geoadd-example.js
File metadata and controls
35 lines (30 loc) · 896 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
/*
* Spade GEOADD example
*/
var log = console.log
, util = require( 'util' )
, Spade = require( '../' )
, client = Spade()
, cback = function ( err, data, fn ) {
log( 'ex.: cback gets:', err, fn( data[ 0 ] ) );
}
, key = 'Sicily'
, gpoints = [ 13.361389, 38.115556, 'Palermo', 15.087269, 37.502669, 'Catania' ]
;
client.on( 'error', function ( ocmd ) {
log( 'error', ocmd );
} );
client.on( 'ready', function () {
client.commands.flushdb( false, function ( err, data, fn ) {
if ( err ) {
log( 'redis -ERR reply!', data );
return;
}
log( 'flushdb', data );
client.commands.geoadd( key, gpoints, function ( err, data, fn ) {
log( 'geoadd', key, gpoints );
log( 'reply', data );
} );
} );
} );
client.connect( null);