diff options
author | Filip Spiridonov <filip.spiridonov@gmail.com> | 2018-04-17 20:21:30 -0700 |
---|---|---|
committer | James E. King, III <jking@apache.org> | 2018-04-17 23:21:30 -0400 |
commit | 0293c3643b0075b510b9d92b2cc39b6d5e0fadb8 (patch) | |
tree | afb872ce652b31d1b8375c8c18e7b2825dbe21d2 /lib/nodejs | |
parent | b255790b8e99a671ec59bf819019f3344ae37237 (diff) | |
download | thrift-0293c3643b0075b510b9d92b2cc39b6d5e0fadb8.tar.gz |
Add JS language highlighting in readme (#1538)
Client: nodejs
Diffstat (limited to 'lib/nodejs')
-rw-r--r-- | lib/nodejs/README.md | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/lib/nodejs/README.md b/lib/nodejs/README.md index 5b15ce647..50acfbdbe 100644 --- a/lib/nodejs/README.md +++ b/lib/nodejs/README.md @@ -38,25 +38,27 @@ You can compile IDL sources for Node.js with the following command: Here is a Cassandra example: - var thrift = require('thrift'), - Cassandra = require('./gen-nodejs/Cassandra') - ttypes = require('./gen-nodejs/cassandra_types'); - - var connection = thrift.createConnection("localhost", 9160), - client = thrift.createClient(Cassandra, connection); - - connection.on('error', function(err) { - console.error(err); - }); - - client.get_slice("Keyspace", "key", new ttypes.ColumnParent({column_family: "ExampleCF"}), new ttypes.SlicePredicate({slice_range: new ttypes.SliceRange({start: '', finish: ''})}), ttypes.ConsistencyLevel.ONE, function(err, data) { - if (err) { - // handle err - } else { - // data == [ttypes.ColumnOrSuperColumn, ...] - } - connection.end(); - }); +```js +var thrift = require('thrift'), + Cassandra = require('./gen-nodejs/Cassandra') + ttypes = require('./gen-nodejs/cassandra_types'); + +var connection = thrift.createConnection("localhost", 9160), + client = thrift.createClient(Cassandra, connection); + +connection.on('error', function(err) { + console.error(err); +}); + +client.get_slice("Keyspace", "key", new ttypes.ColumnParent({column_family: "ExampleCF"}), new ttypes.SlicePredicate({slice_range: new ttypes.SliceRange({start: '', finish: ''})}), ttypes.ConsistencyLevel.ONE, function(err, data) { + if (err) { + // handle err + } else { + // data == [ttypes.ColumnOrSuperColumn, ...] + } + connection.end(); +}); +``` <a name="int64"></a> ## Int64 |