jovo-db-cosmosdb
TypeScript icon, indicating that this package has built-in type declarations

3.6.2 • Public • Published

Azure CosmosDB Database Integration

To view this page on the Jovo website, visit https://v3.jovo.tech/marketplace/jovo-db-cosmosdb

Learn how to store user specific data of your Alexa Skills and Google Actions to Cosmos DB.

Tutorial: Deploy to Azure

Introduction

The Cosmos DB integration allows you to store user session data in the NoSQL service running on Azure using their MongoDB API. This integration is especially convenient if you're running your voice app on Azure Functions. You can find the official documentation about Cosmos DB here: docs.microsoft.com/cosmos-db.

Learn more about hosting your application on Azure Functions.

Configuration

Download the package like this:

$ npm install --save jovo-db-cosmosdb

Cosmos DB can be enabled in the src/app.js file like this:

// @language=javascript

// src/app.js

const { CosmosDb } = require('jovo-db-cosmosdb');

// Enable DB after app initialization
app.use(new CosmosDb());

// @language=typescript

// src/app.ts

import { CosmosDb } from 'jovo-db-cosmosdb';

// Enable DB after app initialization
app.use(new CosmosDb());

Inside your config.js file you have to set your primary connection string and your database name. You can also optionally set the collection name (default is UserData):

// @language=javascript

// src/config.js

module.exports = {
    
    db: {
        CosmosDb: {
            uri: '<primary_connection_string>',
            databaseName: '<database_name>',
            collectionName: '<collection_name>'
        }
    }

    // ...

};

// @language=typescript

// src/config.ts

const config = {
    
    db: {
        CosmosDb: {
            uri: '<primary_connection_string>',
            databaseName: '<database_name>',
            collectionName: '<collection_name>'
        }
    }

    // ...

};

Readme

Keywords

none

Package Sidebar

Install

npm i jovo-db-cosmosdb

Weekly Downloads

53

Version

3.6.2

License

Apache-2.0

Unpacked Size

17.3 kB

Total Files

10

Last publish

Collaborators

  • jovotech