This article demonstrates a pattern for accessing graph databases in TypeScript. Make sure you read Part 1 - without it, these next steps won’t make sense. This article assumes an intermediate knowledge of TypeScript and how generics and interfaces work within the language. This article also mentions the Data Mapper and Factory patterns. Graph Database Interface Most books about program design will spend some time talking about the benefits of separation between application logic and storage logic.
If you’ve read CosmosDB + Gremlin + TypeScript = :| - you’ll know that we’ve recently begun working with graph databases. Specifically graph databases that communicate using Gremlin. This article demonstrates a TypeScript pattern for communicating with a graph database through the Gremlin query language. This article assumes you have an intermediate knowledge of TypeScript and know how to create, compile, and run a TypeScript project. In the interest of article length we will only be implementing a record creation method.
I’m writing this article after only two weeks of working with Gremlin and CosmosDB. What I’m writing about could be dead wrong. I honestly hope so, because my job would be much easier if I’m missing something and what little goodwill I had towards Azure before this experience might be restored. This article assumes that you have an intermediate knowledge of TypeScript and a basic knowledge of Gremlin and CosmosDB. I won’t be stopping to explain the benefits of TypeScript or what Gremlin is and how it works, but I have included links to resources that do.