0

I have looked at the example for the thrift client for js in http://thrift.apache.org/tutorial/js/ - The documentation was too poor.

I have the thrift file(example.thrift) and the thrift compiler converted it to 2 .js files.One was exampleService.js and another was re_types.js.

I have added both these scripts in my html page.

As per the documentation

var transport = new Thrift.Transport("/thrift/service/tutorial/");

But i get an error in the line i add the above statement

Uncaught ReferenceError: Thrift is not defined

Iam new to thrift implementation.Am i missing something

user2753614
  • 9
  • 1
  • 2
  • Add thrift library ...and you can also refer this question http://stackoverflow.com/questions/16350995/thrift-transport-in-javascript-client – Abhinav Dec 09 '13 at 10:53

1 Answers1

4

You have to include the Thrift library for JavaScript (lib\js\thrift.js) as well. The library contains the rest of the code which both the generated scripts and your code will use. This pattern is the same for all supported languages. The whole sample code is also part of the Thrift package, for JavaScript it's under tutorial\js\tutorial.html

PS: If you have an idea how to make the tutorial better - patches are highly appreciated.

JensG
  • 13,148
  • 4
  • 45
  • 55