An open API service indexing awesome lists of open source software.

https://github.com/azure-samples/cosmos-db-apache-cassandra-javascript-samples

Sample JavaScript applications for Azure Cosmos DB for Apache Cassandra
https://github.com/azure-samples/cosmos-db-apache-cassandra-javascript-samples

apache-cassandra azure cosmos-db javascript nodejs

Last synced: 5 months ago
JSON representation

Sample JavaScript applications for Azure Cosmos DB for Apache Cassandra

Awesome Lists containing this project

README

          

# Azure Cosmos DB for Apache Cassandra client library samples for JavaScript

[![Validate Node.js projects](https://github.com/Azure-Samples/cosmos-db-apache-cassandra-javascript-samples/actions/workflows/validate.yml/badge.svg)](https://github.com/Azure-Samples/cosmos-db-apache-cassandra-javascript-samples/actions/workflows/validate.yml)

## Getting started

This repo has a [devcontainer](https://containers.dev) environment making it easy to get started.

[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/Azure-Samples/cosmos-db-apache-cassandra-javascript-samples?quickstart=1)

### Run the app

Configure your Azure Cosmos DB credentials as environment variables.

```bash
export COSMOS_ENDPOINT=""
export COSMOS_KEY=""
```

> **💡 TIP**: If you don't have an Azure Cosmos DB account, [create a free account](https://cosmos.azure.com/try/).

Run the quickstart sample app using the [`cassandra-driver`](https://www.npmjs.com/package/cassandra-driver) package from NPM.

```bash
cd 001-quickstart/
npm install cassandra-driver
npm run start
```

### Validate any changes you make

If you change the code, run the linter.

```bash
cd ./
npm install eslint-config-standard --no-save
```

```bash
cd ./001-quickstart/
npx eslint .
```

### Troubleshooting certificate errors

If you use a self-signed certificate (emulator, Docker, etc.), you may need to disable Node's validation:

```javascript
const client = new Client({
...,
...,
...,
sslOptions: {
rejectUnauthorized: false
}
})
```