Inspiration

A few weeks ago, I was looking into integrating TigerGraph with an application I was create with a Node.js backend. However, as a beginner, I found it difficult to navigate through how exactly TigerGraph could be installed with JavaScript. After learning the process, similar to pyTigerGraph, I created a library that would allow full-stack developers and other users to easily interact with TigerGraph using my NPM library: TigerGraph.js.

By creating this library, I think it'll make TigerGraph easier to use and more compelling to full-stack developers and also beginners who are brand new to JavaScript. (JavaScript was my first language.)

What it does

I created a library (TigerGraph.js) and provided documentation for TigerGraph.js to allow users to more easily use and integrate TigerGraph with Node.js. From the website, you can look at particular commands and use the library to query your graph.

To use it, you can install the library with:

npm install tigergraph.js

Generate a token, then create a connection and then code whatever you please.

How I built it

I used Node.js, which queried the TigerGraph REST API and simplified the requests to a single function. To create the queries, I used the standard https library so importing external libraries weren't necessary. The createToken was a single function that got exported, but to create the connection, I used and exported a class. Finally, I created an NPM account to publish the library. When creating the commands, I tried to make them similar to pyTigerGraph so going back and forth doesn't pose a problem. For the documentation, I use mkDocs and their material theme and I published the website on GitHub Pages.

Challenges I ran into

Dealing with Promises and callbacks were difficult for me and took a few days till I was able to complete it. In addition, figuring out how to create the REST calls (especially with the headers) proved to be difficult for me as well. Before, I constantly got bad request errors and I didn't understand why. After a few days, I realised it was because the token wasn't sending and I couldn't send the token through the url; rather, I had to send it through the header.

Accomplishments that I'm proud of

I'm proud that I got the opportunity to create and publish an NPM library. In addition, when I was experimenting with TigerGraph.js and Discord.js, I found it cool how my work is a real library, which can work with other libraries and be used by others. I also found it mind-blowing how I could actually use it with projects.

What I learned

I learned how to use TigerGraph's REST API and pass a header in a GET request with https. In addition, I learned how to create an NPM library, and I've gained a thorough respect for those who create libraries now. I learned how to deal with the asynchronous ways of Node.js by using callbacks and promises.

What's next for TigerGraph.js

I'm going to create more functions and add more example projects (and finally finish the project that inspired me to build this library!). I also hope to explore more about using this library with JavaScript in the browser by using Browserify. In addition, I also want to maintain the library and explore the gsql endpoints.

Share this project:

Updates