You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jk...@apache.org on 2018/04/18 03:21:33 UTC

[thrift] branch master updated: Add JS language highlighting in readme (#1538)

This is an automated email from the ASF dual-hosted git repository.

jking pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new 0293c36  Add JS language highlighting in readme (#1538)
0293c36 is described below

commit 0293c3643b0075b510b9d92b2cc39b6d5e0fadb8
Author: Filip Spiridonov <fi...@gmail.com>
AuthorDate: Tue Apr 17 20:21:30 2018 -0700

    Add JS language highlighting in readme (#1538)
    
    Client: nodejs
---
 lib/nodejs/README.md | 40 +++++++++++++++++++++-------------------
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/lib/nodejs/README.md b/lib/nodejs/README.md
index 5b15ce6..50acfbd 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

-- 
To stop receiving notification emails like this one, please contact
jking@apache.org.