CosmosDB (Gremlin API) on Azure Functions and Serverless Framework.
Gremlin commands are not finished, but if you want to just get started then this should get you well on your way.
The tech is listed a bit more below:
Stack
- Serverless Framework
- Azure Functions + Azure Storage for storing the function + Azure API Management
- Webpack for bundling and optimizing
- Babel for transpiling files
- Typescript so we can write better code
- Azure account
- Logged in to Azure through environment
- High enough credentials to create required resources
- Recommended: Serverless Framework installed on your system
This repo does not currently cover setting up the required CosmosDB (Gremlin) database on Azure.
It should be pretty easy if you follow the quickstarts at the bottom of this document. You only need to:
- Go to CosmosDB
- Create a CosmosDB (Gremlin) database
- Create a container (use
pk
as partition key) - Pick out your primary key and set that, along with your database/container names, in
src/config.ts
.
Install dependencies with npm install
or yarn add
.
az account clear
az login
Then set credentials as per instructions at https://github.com/serverless/serverless-azure-functions#advanced-authentication.
Run sls offline
. After a bit of building files and doing its magic, you get a prompt looking like:
Http Functions:
demoFunction: [GET] http://localhost:7071/demoFunction
Hit that URL and you're ready! It doesn't do auto-reloads though.
- How to manipulate a Gremlin Cosmos DB from inside a Node.js Azure Function
- Diving into Gremlin queries in Azure Cosmos DB
- Introduction to Gremlin API in Azure Cosmos DB
- Quickstart: Create, query, and traverse an Azure Cosmos DB graph database using the Gremlin console
- Quickstart: Build a Node.js application by using Azure Cosmos DB Gremlin API account
- Graph data modeling for Azure Cosmos DB Gremlin API